#K86817. Counting Character Occurrences

    ID: 36949 Type: Default 1000ms 256MiB

Counting Character Occurrences

Counting Character Occurrences

In this problem, you are given a string S and a character c. Your task is to count and output the number of occurrences of c in S.

The solution should read inputs from standard input (stdin) and print the result to standard output (stdout).

In mathematical notation, if we denote by \(f(S, c)\) the number of times character \(c\) appears in string \(S\), then

\[ f(S, c) = \sum_{i=1}^{|S|} \mathbf{1}_{\{S_i = c\}}, \]

where \(\mathbf{1}_{\{S_i = c\}}\) is 1 if \(S_i = c\) and 0 otherwise.

inputFormat

The input consists of two lines:

  1. The first line contains a non-empty string S.
  2. The second line contains a single character c whose occurrences in S are to be counted.

Note: The string may contain spaces and punctuation.

outputFormat

Output a single integer representing the number of times the character c appears in the string S.

## sample
hello
l
2