-->
当前位置:首页 > 题库

PROGRAMMING:Statistical character

Luz5年前 (2021-05-10)题库329
Counts the number of occurrences of the specified character in a given string.
###Input format:
The test input contains several test cases, and each test case contains two lines. The first line is a string no more than 5 in length, and the second line is a string no more than 80 in length. Note that the string here contains spaces, which may also be one of the characters to be counted. When reading '#', the input ends, and the corresponding result is not output.
###Output format:
For each test case, count the number of times that each character of the string in the first line appears in the string in the second line, and output it in the following format:
c0 n0
c1 n1
c2 n2
...
Where CI is the ith character in the first line and Ni is the number of times CI appears.
###Input example:
```in
I
THIS IS A TEST
i ng
this is a long test string
#
```
###Output example:
```out
I 2
i 3
five
n 2
g 2
```
###Example explanation:
In the second test case, the space is also one of the counted characters< br>





answer:If there is no answer, please comment