10978 - Let's Play Magic
N cards are arranged in a circle. Starting from a certain card, the magician counts cards in clockwise direction and spelling N words. When the last letter of a word is pronounced, he turns over the card and removes it from the circle.
Given the sequence of words, and the order, in which the cards are removed, find the initial arrangement of cards in the circle.
Simply simulate the magician's actions and recover the arrangement of cards.
13 AS ACE 2S TWO 3S THREE 4C FOUR 5C FIVE 6C SIX 7D SEVEN 8D EIGHT 9D NINE TH TEN JH JACK QH QUEEN KH KING 0
QH 4C AS 8D KH 2S 7D 5C TH JH 3S 6C 9D