#abc301a. A - Overall Winner

A - Overall Winner

Score : 100100 points

问题描述

高桥和青木进行了 NN 场游戏。给你一个长度为 NN 的字符串 SS,表示这些比赛的结果。如果字符串 SS 的第 ii 个字符是 T,则表示高桥赢了第 ii 场游戏;如果是 A,则表示青木赢了那场比赛。

高桥和青木之间的最终胜者是在比赛中获胜次数较多的一方。如果他们的胜利场数相同,则最终胜者是先达到这个胜利场数的一方。请找出最终胜者:高桥或青木。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

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

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

Input

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

NN

SS

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

update @ 2024/3/10 08:26:27