DMOPC '17 Contest 4 P5 - Revised IOI
View as PDFThe IOI has decided to change its format! Now, it will be composed of  true or false questions about the socioeconomic factors affecting occupations in computer science. Shortly after the contest, Team Canada's four members are checking their answers with each other. Their answers will be represented as four strings of length 
 composed of 
Ts and Fs. The score of a member is the number of correct answers minus the number of wrong answers (no blanks are allowed). The score of a team is the sum of the squares of the members' scores.
For example, if  and Team Canada's members answered 
TFFTF, TTFTT, FTTTF, and TFFFF, and the answer key was TTTTT, then the members' scores would be  and the team's score would be 
.
The contestants have not yet been marked as you have stolen the answer key! You plan to adjust the answer key. What answer key will maximize Team Canada's score?
If there are multiple valid answer keys, any of them will be accepted.
Constraints
Input Specification
The first line of input will contain a single integer .
The next four lines of input will each contain a string of length  composed of 
Ts and Fs representing the answers of each of Team Canada's members.
Output Specification
Output a single string of length  composed of 
Ts and Fs. This string should represent an answer key which maximizes Team Canada's score.
Sample Input 1
5
TFFTF
TTFTT
FTTTF
TFFFF
Sample Output 1
TFFFF
Sample Input 2
8
TTTTTTTT
TTTTTTTT
TTTTTTTT
FFFFFFFF
Sample Output 2
FFFFFFFF
Comments