No.267 Card Sort
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もしくは右上の雲マークをクリックしてアカウントを作成してください。