All tasks
Easystringsloops

Count a Character

Time limit 2 s · Memory 64 MBAcceptance: —Solved by: 0

Statement

The first line contains a string of lowercase Latin letters, the second line contains a single character c. Print how many times c occurs in the string.

Examples

Example 1
Input
banana
a
Output
3
Example 2
Input
hello
z
Output
0

Constraints

  • String length is between 1 and 10^5
  • c is a lowercase Latin letter
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.