

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 150 点
問題文
A, B, C の三兄弟がいます。この 3 人の年齢関係は、3 つの文字 S_{\mathrm{AB}},S_{\mathrm{AC}},S_{\mathrm{BC}} によって与えられ、それぞれ以下を意味します。
- S_{\mathrm{AB}} が
<
の場合 A は B より年下であり、>
の場合 A は B より年上である。 - S_{\mathrm{AC}} が
<
の場合 A は C より年下であり、>
の場合 A は C より年上である。 - S_{\mathrm{BC}} が
<
の場合 B は C より年下であり、>
の場合 B は C より年上である。
三兄弟の次男、つまり二番目に年上の人は誰ですか?
制約
- S_{\mathrm{AB}},S_{\mathrm{AC}},S_{\mathrm{BC}} はそれぞれ
<
または>
- 入力に矛盾は含まれない。つまり、与えられた大小関係を全て満たす年齢関係が必ず存在する入力のみが与えられる。
入力
入力は以下の形式で標準入力から与えられる。
S_{\mathrm{AB}} S_{\mathrm{AC}} S_{\mathrm{BC}}
出力
三兄弟の次男、つまり二番目に年上の人の名前を出力せよ。
入力例 1
< < <
出力例 1
B
A が B より年下であり、B が C より年下であることから、C が長男、B が次男、A が三男であることがわかります。よって答えは B
です。
入力例 2
< < >
出力例 2
C
Score : 150 points
Problem Statement
There are three brothers named A
, B
, and C
. The age relationships among them are given by three characters S_{\mathrm{AB}}, S_{\mathrm{AC}}, S_{\mathrm{BC}}, which mean the following:
- If S_{\mathrm{AB}} is
<
, then A is younger than B; if it is>
, then A is older than B. - If S_{\mathrm{AC}} is
<
, then A is younger than C; if it is>
, then A is older than C. - If S_{\mathrm{BC}} is
<
, then B is younger than C; if it is>
, then B is older than C.
Who is the middle brother, that is, the second oldest among the three?
Constraints
- Each of S_{\mathrm{AB}}, S_{\mathrm{AC}}, S_{\mathrm{BC}} is
<
or>
. - The input contains no contradictions; that is, there always exists an age relationship that satisfies all given inequalities.
Input
The input is given from Standard Input in the following format:
S_{\mathrm{AB}} S_{\mathrm{AC}} S_{\mathrm{BC}}
Output
Print the name of the middle brother, that is, the second oldest among the three.
Sample Input 1
< < <
Sample Output 1
B
Since A is younger than B, and B is younger than C, we can determine that C is the oldest, B is the middle, and A is the youngest. Hence, the answer is B
.
Sample Input 2
< < >
Sample Output 2
C