Playing Cards Validation

AtCoder
IDabc277_b
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
4
H3
DA
D3
SK
Output #1
Yes

One can verify that the three conditions are all satisfied.
Input #2
5
H3
DA
CK
H3
S7
Output #2
No

Both $S_1$ and $S_4$ are `H3`, violating the third condition.
Input #3
4
3H
AD
3D
KS
Output #3
No
Input #4
5
00
AA
XX
YY
ZZ
Output #4
No
API Response (JSON)
{
  "problem": {
    "name": "Playing Cards Validation",
    "description": {
      "content": "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.   ",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc277_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given $N$ strings, each of length $2$, consisting of uppercase English letters and digits. The $i$\\-th string is $S_i$.  \nDetermine whether the following three conditions are all satisfied.  \n...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments