/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
英大文字および数字からなる 2 文字の文字列が N 個与えられます。i 個目の文字列は S_i です。
以下の 3 つの条件をすべて満たすか判定してください。
・すべての文字列に対して、1 文字目は H , D , C , S のどれかである。
・すべての文字列に対して、2 文字目は A , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , T , J , Q , K のどれかである。
・すべての文字列は相異なる。つまり、i \neq j ならば S_i \neq S_j である。
制約
- 1 \leq N \leq 52
- S_i は英大文字および数字からなる 2 文字の文字列
入力
入力は以下の形式で標準入力から与えられる。
N S_1 S_2 \vdots S_N
出力
3 つの条件をすべて満たす場合は Yes、そうでない場合は No を出力せよ。
入力例 1
4 H3 DA D3 SK
出力例 1
Yes
このとき 3 つの条件をすべて満たすことが確認できます。
入力例 2
5 H3 DA CK H3 S7
出力例 2
No
S_1 と S_4 がともに H3 となってしまっているため、3 番目の条件に反します。
入力例 3
4 3H AD 3D KS
出力例 3
No
入力例 4
5 00 AA XX YY ZZ
出力例 4
No
Score : 200 points
Problem Statement
You are given N strings, each of length 2, consisting of uppercase English letters and digits. The i-th string is S_i.
Determine whether the following three conditions are all satisfied.
・For every string, the first character is one of H, D, C, and S.
・For every string, the second character is one of A, 2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K.
・All strings are pairwise different. That is, if i \neq j, then S_i \neq S_j.
Constraints
- 1 \leq N \leq 52
- S_i is a string of length 2 consisting of uppercase English letters and digits.
Input
The input is given from Standard Input in the following format:
N S_1 S_2 \vdots S_N
Output
If the three conditions are all satisfied, print Yes; otherwise, print No.
Sample Input 1
4 H3 DA D3 SK
Sample Output 1
Yes
One can verify that the three conditions are all satisfied.
Sample Input 2
5 H3 DA CK H3 S7
Sample Output 2
No
Both S_1 and S_4 are H3, violating the third condition.
Sample Input 3
4 3H AD 3D KS
Sample Output 3
No
Sample Input 4
5 00 AA XX YY ZZ
Sample Output 4
No