#K73267. Count Character Occurrences in a String
Count Character Occurrences in a String
Count Character Occurrences in a String
You are given a string and a query character. Your task is to count how many times the query character appears in the string. The counting is case sensitive. For each test case, you will be provided with one pair: a string and a character. Your job is to compute and output the number of occurrences of the given character in the string.
In mathematical form, if we denote the string as S and the query character as c, you should calculate (#{i \mid S_i = c}), where (S_i) is the i-th character of S.
inputFormat
The first line of input contains an integer T representing the number of test cases. Each of the following T lines contains a test case with two space-separated inputs: a string S and a character c.
outputFormat
For each test case, output a single integer on a new line representing the number of times the character c appears in the string S.## sample
1
hello l
2