問題一覧 > 通常問題

No.267 Card Sort

レベル : / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 311
作問者 : kzyKT
お気に入りにしたユーザー ProblemId : 581 / 自分の提出
問題文最終更新日: 2026-06-25 17:13:20
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 118 (順位表) の他の問題:

Problem Statement

You have decided to play cards with your friends.
The cards have been dealt to you, but you cannot rest until the cards in your hand are arranged in order.
Rearrange the cards into the proper order.

The cards are arranged from left to right in the order of diamonds, clubs, hearts, spades.
Within each suit, the cards are arranged from left to right in ascending order of number.

Input

$N$
$m_1n_1 \ m_2n_2 \dots m_Nn_N$

Line $1$ gives the number of cards.
Line $2$ gives the information of the cards, separated by spaces.

$1 \le N \le 52$
Each card is represented as $m_in_i$, where $m_i$ denotes the suit and $n_i$ denotes the number.
Suit$ \ - \ D:$diamonds, $C:$clubs, $H:$hearts, $S:$spades.
Number$ \ - \ 2\sim9:$the respective numbers, $A:1$, $T:10$, $J:11$, $Q:12$, $K:13$.

No two cards with the same suit and the same number are given.

Output

Print the sorted cards, separated by spaces.

Sample

Sample 1
Input
4
H2 D2 S2 C2
Output
D2 C2 H2 S2

The cards are arranged in the order of $D$, $C$, $H$, $S$.

Sample 2
Input
5
ST SA SK SQ SJ
Output
SA ST SJ SQ SK

Sample 3
Input
6
S4 SA C5 C4 CA DA
Output
DA CA C4 C5 SA S4

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。