Write a full program (starting from #include) ) that is supposed to get an input sentence from the user and write a function that counts the number of character doubles in a phrase entered by the user. The output should look like the example below.
Enter sentence: Hobbits love cookies!! There are 3 character doubles.
You do not have to worry about detecting upper vs. lower-case letters, nor do you have to handle the case when a character occurs three times or more in a row.
Set the count to zero.
Examine each character in turn, starting with the second letter.
If character is the same as the previous one, add one to the count.
Read in the word into an std::string. Strings allow accessing by index. For two letters to be subsequent, their indeces have to be 1 apart. Thus, by comparing myString[i] to myString[i+1] for all necessary values of i, you can determine if there are "doubles".