// if_01.cpp -- while loop used to get input 
#include <iostream>
#include <cstring>

int main()
{
    using namespace std;
    string word = "";    // initializing the word string
    int i = 0;
    int aCount = 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, then add one to a counter
      // which will keep track of the number of a's that
      // are in the word
      if (word[i] == 'a') {
	aCount++;
      }

      i++;
    }

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

}
