// ifelse_01.cpp -- if and else statements
#include <iostream>
#include <cstring>

int main()
{
    using namespace std;
    string word = "";    // initializing the word string
    int i = 0;
    int aCount = 0;
    int otherCount = 0;

    cout << "Please enter a long word: ";
    cin >> word;

    // while loop to go through every character in the string
    // until it reached the end of the word
    while(word[i] != '\0') {

      // if the character is an 'a' add one to the a counter
      // otherwise add one to the otherCount
      if (word[i] == 'a') 
	aCount++;
      else
	otherCount++;
 
      i++;
    }

    cout << "\nYour word had " << aCount << " a's in it.\n";
    cout << "\nYour word had " << otherCount << " non a's in it.\n";

}

