Problem Statistics
https://codeforces.com/group/cRJbcAFEwS/contest/485694/problem/B
Last updated
https://codeforces.com/group/cRJbcAFEwS/contest/485694/problem/B
Last updated
Abby and Cody want to make a new website called Abakoda, where beginner programmers can join friendly programming contests and improve their skills.
Now they are working on displaying the contest rankings. They need to show the number of contestants who have solved each problem on the bottom of the matching column of the rankings table.
Aba
100
0
100
0
Abby
100
100
100
100
Koda
100
0
0
0
Cody
100
100
100
0
Solved By
4
2
3
1
Having this bottom row on the rankings can help contestants: if more people have solved a problem, it is probably easier.
Abby and Cody need your help. They already wrote code that gets which problems were solved by each contestant. Write a program that prints the number of contestants who have solved each problem.
The input contains several lines.
The first line of input contains one integer n, the number of contestants.
This is followed by lines of input. Each of these lines contains a string of capital letters, representing what problems were solved by a single contestant. The only letters that appear in these lines are A, B, K, or D. Each letter appears at most once in each string. The letters in a string are not necessarily arranged in alphabetical order. Each string is non-empty: every contestant solved at least one problem.
Your program must print a single line of output containing four integers separated by spaces: the number of contestants who solved problem A, followed by the number of contestants who solved problem B, followed by the number of contestants who solved problem K, followed by the number of contestants who solved problem D.
In the first sample test case, there are four contestants.
The first contestant solved problems A and K.
The second contestant solved problems A, B, K, and D.
The third contestant solved problem A.
The fourth contestant solved problems A, B, and K.
Therefore, the correct output is 4 2 3 1.
A total of contestants solved problem . A total of contestants solved problem . A total of contestants solved problem . A total of contestant solved problem .