Problem description There are many matches in the football match, such as the World Cup knockout and European Champions League knockout matches. When both sides of the match still won't compete after the formal match and the overtime match, A penalty fight is required to determine who can win the final victory. The rules for a penalty fight are very simple. The two sides take turns to send players to take a penalty, with each side being fined five. If the final five rounds of penalty kicks are not selected after the final match, the final match starts. One player from both sides sends a penalty until one party makes a penalty and the other party fails to make a penalty.
In the North American professional ice hockey league, there is also a ball competition. Unlike the rules of football, it only takes three rounds of penalty and then enters the final match stage. Other rules are the same.
In this question, the input will show whether to throw each penalty, and your task is to output a score board ".
The input contains multiple groups of data. The first row of each group of data contains an integer N (1 <= n <= 18), which indicates the total number of penalty points received by both parties. n = 0 indicates that the input is over. Then there are n rows. Each row is a string in the following format:
XXXX good: indicates the penalty.
Or XXXX no good: indicates that the penalty is not received.
XXXX indicates the player name (all composed of letters and spaces, so that no ambiguity exists)
Each line must not exceed 100 characters.
There must be only one space between XXXX, good, xxxx, no, and good.
Good and no good are all in lower case. This question is case-sensitive.
The data does not guarantee the final results of the penalty fight, nor does it guarantee that this set of data will be ended immediately after the final event (that is, you don't have to judge whether the penalty fight is over, just add the final penalty to the score ).
Output outputs a score board for each group of data. If a penalty is triggered, 'O' is marked in the corresponding place. If not, 'X' is marked '. The information of the first penalty team is above, and the last penalty is below. The rightmost mark is the score of the two teams. For specific formats, see the sample output. Note that if only one penalty is received in a single round, '-' is entered in the corresponding part of the next penalty '-'.
Sample Input
6Riise goodBallack goodGerrard no goodLampard no goodFernando Torres goodMalouda good9Christiano Ronaldo no goodMessi no goodGiggs goodAbidal no goodCarrick goodRonaldinho goodRooney goodHenry no goodTevez good0
Sample output
1 2 3 scoreo x o 2O x o 21 2 3 4 5 scorex O 4x x o x-1 tip: the number of spaces must be the same as that of the sample output, otherwise, it is likely to be judged as a "format error ).
// Question, the most important is no.
# Include <stdio. h> # include <string. h> int main () {char STR [110] [105]; int N, I, K, score [2], cont, Len [110]; char C [108]; while (scanf ("% d", & N )! = EOF & N) {getchar (); score [0] = score [1] = 0; cont = 0; If (N % 2 = 0) k = n/2; else k = (n + 1)/2; for (I = 1; I <= N; I ++) {gets (STR [I]); Len [I] = strlen (STR [I]);} for (I = 1; I <= K; I ++) // print the first line of the score board {if (I = 1) printf ("% d", I); else printf ("% d", I );} printf ("Score \ n"); for (I = 1; I <= N; I ++) {If (STR [I] [Len [I]-7] = 'n' & STR [I] [Len [I]-6] = 'O '& & STR [I] [Len [I]-8] = ''& STR [I] [Len [I]-5] = '') // The key lies in determining the No and no locations, and there must be spaces before and after no {C [I] = 'X ';} else {C [I] = 'O'; if (I % 2 = 0) // record the score of both teams, score [1] ++; else score [0] ++ ;}}for (I = 1; I <= N; I + = 2) // score of the first team: {putchar (C [I]); putchar ('');} printf (" % d \ n ", score [0]); for (I = 2; I <= N; I + = 2) // score of the two teams {putchar (C [I]); putchar (''); cont ++;} If (cont! = K) printf ("-"); printf ("% d \ n", score [1]);} return 0 ;}