Counting a Character · Compiler

Counting a Character

Count the positions in a word that contain a given letter. Count adjacent matches separately.

Input
Two space-separated tokens on one line, a word of 1 to 100 lowercase ASCII letters followed by one lowercase ASCII letter.
Output
Print the number of occurrences of the letter.

Compiler Explorer runs your code when you run or check it.

Loading your exercise draft…