atcoder#ABC301A. [ABC301A] Overall Winner
[ABC301A] Overall Winner
Score : points
Problem Statement
Takahashi and Aoki played games.
You are given a string of length , representing the results of these games.
Takahashi won the -th game if the -th character of is T
, and Aoki won that game if it is A
.
The overall winner between Takahashi and Aoki is the one who won more games than the other. If they had the same number of wins, the overall winner is the one who reached that number of wins first. Find the overall winner: Takahashi or Aoki.
Constraints
- is an integer.
- is a string of length consisting of
T
andA
.
Input
The input is given from Standard Input in the following format:
Output
If the overall winner is Takahashi, print T
; if it is Aoki, print A
.
5
TTAAT
T
Takahashi won three games, and Aoki won two. Thus, the overall winner is Takahashi, who won more games.
6
ATTATA
T
Both Takahashi and Aoki won three games. Takahashi reached three wins in the fifth game, and Aoki in the sixth game. Thus, the overall winner is Takahashi, who reached three wins first.
1
A
A