-->
当前位置:首页 > 题库

PROGRAMMING:Jin Liang and voting

Luz5年前 (2021-05-10)题库512
There are n people in the lab who are now voting on a very important question raised by Jin Liang. The world's major media are trying to predict the voting results.
Everyone belongs to one of two factions: sweet bean curd or salty bean curd. The voting process is quite complicated:
1. Every one of the n people voted. They started on the 1st and voted one by one to the nth.
2. When a person votes, he can't do anything or veto. One of the other people no longer has the right to vote. He is allowed to veto those who have voted or have not. If someone is voted down, he will not vote until the end of the voting. When all the people have finished their voting, the procedure repeats: once again, everyone starts from the 1st, voting one by one for those who are still eligible to vote.
3. The process is repeated until only one person is eligible to vote and he determines the result of the whole vote.
4. You know which faction everyone belongs to and their behavior is the best (they also know the voting order and who belongs to which faction). Predict the voting results.
###Input format:
The first line of input contains a single integer n (1 ≤ n ≤ 100) - number of people.
The next line contains n characters. If the i-th person is a sweet bean curd chauvinist, the i-th character is "t"; if he is a salty bean curd chauvinist, the i-th character is "X".
###Output format:
If the result of the vote is that the sweet bean curd faction wins, print't '. If the salty bean curd faction wins, print' x '.
###Input example:
Here is a set of inputs. For example:
```in
five
TTXXX
six
TTXXXX
```
###Output example:
The corresponding output is given here. For example:
```out
T
X
```







answer:If there is no answer, please comment