lets say you have a string name NAME and you wanted to count numbers of 'a' in it.
You should try

int count = 0; //to count the numbers of appearance of letter

for(int i = 0; i <...