|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||5||4||4||80.000%|
When I was at school, many, many years ago, we used to play a simple game involving tossing a coin. The first player would call "heads" or "tails", the second would toss the coin. The first player gained a point for every correct call, the second player gained one for every incorrect call. When we got bored, we added up the scores!
Input for this problem will consist of a number of games. Each game will begin with a line containing 2 names of no more than 20 letters each and separated by a space. The second line of each game will contain a single positive integer, n, specifying the number of recorded coin tosses (0 < n <= 1000). n coin tosses follow, each on a single lines containing 2 characters (either 'H' or 'T' – "heads" or "tails"), separated by a space. The first character denotes the call and the second denotes the result. Input will be terminated by a line containing just # #.
Output will be one line for each game. The line will give the name of the first player (as recorded in the input), followed by the first player's score, followed by the name of the second player, followed by the second player's score. Entries on a line will be separated by a single space.
Sally John 5 H H H T H H T T T H Eloise Ahmed 4 H T T T H H T H # #
Sally 3 John 2 Eloise 2 Ahmed 2