A - Overall Winner Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 100

問題文

高橋くんと青木くんが N 回の試合を行いました。 これらの試合の結果を表す長さ N の文字列 S が与えられます。 i 回目の試合の勝者は、Si 文字目が T ならば高橋くん、A ならば青木くんです。

高橋くんと青木くんのうち、勝った試合の数が多い方を総合勝者とします。 ただし、勝った試合の数が同じである場合は、先にその勝ち数に達した者を総合勝者とします。 高橋くんと青木くんのどちらが総合勝者であるか求めてください。

制約

  • 1\leq N \leq 100
  • N は整数
  • ST および A からなる長さ N の文字列

入力

入力は以下の形式で標準入力から与えられる。

N
S

出力

総合勝者が高橋くんならば T を、青木くんならば A を出力せよ。


入力例 1

5
TTAAT

出力例 1

T

高橋くんは 3 回の試合に勝ち、青木くんは 2 回の試合に勝ちました。 よって、勝った試合の数が多い高橋くんが総合勝者です。


入力例 2

6
ATTATA

出力例 2

T

高橋くんと青木くんのどちらも 3 回の試合に勝ちました。 また、高橋くんは 5 回目の試合で 3 勝目に達し、青木くんは 6 回目の試合で 3 勝目に達しました。 よって、先に 3 勝目に達した高橋くんが総合勝者です。


入力例 3

1
A

出力例 3

A

Score : 100 points

Problem Statement

Takahashi and Aoki played N games. You are given a string S of length N, representing the results of these games. Takahashi won the i-th game if the i-th character of S 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

  • 1\leq N \leq 100
  • N is an integer.
  • S is a string of length N consisting of T and A.

Input

The input is given from Standard Input in the following format:

N
S

Output

If the overall winner is Takahashi, print T; if it is Aoki, print A.


Sample Input 1

5
TTAAT

Sample Output 1

T

Takahashi won three games, and Aoki won two. Thus, the overall winner is Takahashi, who won more games.


Sample Input 2

6
ATTATA

Sample Output 2

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.


Sample Input 3

1
A

Sample Output 3

A