I dont know if this will help you because i used c++ for a similar task, but i am trying to help her.
I would suggest to create a for loop to enter each element of the array.
Now using this website;
http://www.paulhorst.com/c241/string.htm[
^]
I noticed that i can check each letter of the string.
then i would increment a counter.
Sorry i am not really very good but i tried my best