Preference
In a new deck of 32 preference cards, the cards are arranged in the following order from top to bottom: hearts, diamonds, clubs, and spades. Each suit begins with a seven, followed by an eight, nine, ten, jack, queen, king, and ace. The shuffling process is as follows: the top half of the deck, consisting of 16 cards, is interleaved with the bottom half. Each card from the top half is inserted into the bottom half such that their original order is preserved. Cards from the top half can be placed above the top card, below the bottom card, or between any two adjacent cards of the bottom half. This shuffling can be repeated up to five times.
Your task is to write a program that determines how to shuffle the cards to achieve a specified order.
Input
The input consists of a single line detailing the desired order of the cards from top to bottom after shuffling. Each card is represented by a letter for the suit (spades - S, clubs - C, diamonds - D, hearts - H) and a rank (ace - A, king - K, queen - Q, jack - J, ten - 0, and others by their numeric value: 9, 8, 7).
Output
The first line of the output should be an integer N (0 ≤ N ≤ 5), representing the number of shuffling steps. The following N lines should describe each shuffling step. Each line must contain 16 numbers indicating the positions where the cards from the top half are placed. These position numbers should be listed in ascending order and separated by spaces. The positions are numbered from top to bottom, ranging from 1 to 32.
For clarity, the input line may be split into two lines for convenience. However, during testing, the input will consist of exactly one line, ending with a newline character.