← Back to Strings
Question 19
Count A Letter
Count A Letter
Read one word and count how many times the lower-case letter a appears in it, using a for loop over the characters and an if that compares each one with 'a', then print the result in the form a appears <count> times. Input: one line, the word, no prompt. A word with no a prints a count of 0.
Expected Output:
a appears 3 times= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Strings
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.