10196 - problem1 Status | Limits Submit Description The input is a string of letters, for example, BbBTTttTUuuUUUkk Find the length of the longest repeat letters. For the above example, the answer is 6, because the longest repeat letters are UuuUUU. Note that we do not have to distinguish uppercases from lowercases, that is, U and u are considered the same. Hint: a. Use while((ch=getchar())!='\n') { … } to read the input data. b. Use another variable prev to remember the previous letter. c. Include ctype.h so that you can use toupper(ch) to convert ch into uppercase, and then you do not need to take care of the case because every letter is uppercase. d. The algorithm can be summarized as follows: while loop: read the current letter and do the loop when the letter is not '\n' i) convert the letter to uppercase ii) if the letter is different from the previous one a. compare the length of the current repeat letter with the longest length we have seen so far; if the length of the current letter is longer, then update the longest length as the new one. b. update the prev as ch c. reset the length of the cur iii) else a. increase the length of the current repeat letter by 1 Input The input is a string of English letters, which can be uppercase or lowercase. There are no whitespaces between the letters, and the input is ended with '\n'. Output The output is a number indicating the length of the longest consecutive letters. Be sure to add a newline character '\n' at the end. Sample Input aaccBBbFFffFKkKkKkKkOJOJOJOJOJOJOJOJOJOJOJOJ EOF Sample Output 8 EOF Tags 10197 - problem2 Status | Limits Submit Description Consider a line-up of 10 people who have different numbers of coins. For example, the numbers of coins they have could be 6 5 8 7 4 10 20 30 40 50 Given a sequence of operations of passing coins forward and backward, carry out all of the operations and print the result. The operations are presented in a format as follows: 4 F 6 4 B 1 5 F 100 5 F 10 7 B 10 1 B 5 where 'F' stands for forward and 'B' stands for backward. The first operation "4 F 6" means that the fourth person gives 6 coins to the next person. Therefore, after this operation, the fourth person has only 1 (=7-6) coin and the fifth person has 10 (=4+6) coins. The second operation "4 B 1" means that the fourth person gives 1 coin to the previous person, and therefore the third person will have 9 (=8+1) coins and the fourth person will have 0 (=1-1) coin. The third operation cannot be done because the fifth person does not have 100 coins to give; In this case, the operation will be ignored and no change is made. The subsequent operations can be carried out based on the same rules. Note that, for the tenth person, a forward pass means giving coins to the first person, and likewise, for the first person, a backward pass means giving coins to the tenth person, such as the last operation "1 B 5" in the above example. Finally, the result should look like 1 5 9 0 0 30 10 30 40 55 Input The first line contains ten positive integers indicating the initial numbers of coins owned by the ten people. The second line contains an integer N (1<=N<=100) denoting the number of operations. The next N lines contain the N operations in the form of Person_Id Forward_Or_Backward Number_Of_Coins Person_Id is from 1 to 10. Number_Of_Coins is a positive integer. Output The output is shown in ten lines, each of which contains the number of coins owned by the person after the operations. Be sure to add a newline character '\n' at the end of each line. Sample Input 6 5 8 7 4 10 20 30 40 50 5 4 F 6 4 B 1 5 F 10 7 B 10 1 B 5 EOF Sample Output 1 5 9 0 0 30 10 30 40 55 EOF Tags 10198 - problem3 Status | Limits Submit Description Consider an N-by-N two-dimensional map. On the map, use the symbol '+' to draw a cross that is centered at the location (ROW, COLUMN) and with a radius of R. Mark the center of the cross as 'S' and fill the rest parts of the map with the symbol '-'. For example, the following is a 7-by-7 map, where the cross is centered at (3, 4) and with a radius of 2. That is, we have N=7, ROW=3, COLUMN=4, and R=2. ---+--- ---+--- -++S++- ---+--- ---+--- ------- ------- Note that, in some cases, the cross might be close to the border of the map and therefore only a part of the cross can be shown on the map. For example, ---+- -++S+ ---+- ---+- ----- Input The first line is an integer N (1<=N<=10) denoting the size of the map. The second line contains two integers ROW and COLUMN (1<=ROW,COLUMN<=10) denoting the location of the cross center. The last line is an integer R (1<=R<=10) denoting the radius. Output The N-by-N map with the specified cross on it, displayed in N lines. Each line is ended with a newline character '\n'. Sample Input 5 2 4 2 EOF Sample Output ---+- -++S+ ---+- ---+- ----- EOF Tags 10772 - The number of occurrences Status | Limits Submit Description Given a string A and n strings B1, B2, B3, …, Bn, count the number of occurrences of string A in each of B1, B2, B3, … , and print the maximum number of occurrences. All of the strings contain only digits. For example, if A is “50” , n = 3, and the n strings are “5005” “055050” “55000” then your answer should be 2 because A appears in “5005” one time, in “055050” two times, and in “55000” one time. So the maximum number of occurrences is 2. Note that if A is “99” and B1 is “9999”, the number of occurrences of A in B1 is counted as 3. You may assume string B1 is always longer than string A. Input The first line of the input is the string A (0