Use string methods to determine the number of times
a letter occurs in a word
Output
word: bookkeeper
letter: k
output: 2
The letter 'k' occurs in the word 'bookkeeper' 2 times.
- Ask the user for a
word - Ask the user for a
letter - Assign the
wordand theletterto variables - Determine how many times the
letteroccurs in theword
Output
Enter a word: hippopotamus
Enter a letter to count: p
Output:
The letter 'p' occurs 3 times in 'hippopotamus'