13361 - Cardcaptor Sakura   

Description

Sakura is a girl with super card magic.

However, you cannot make a living with magic, computer science is all you need.

To make use of her card skills, she tries to write a program to play cards:

 

There are 10 tables (indexed from 0 to 9) and no cards on them initially.

Given a command S, Sakura has to follow the instructions below:

(1) print: print the status of each table with the format :"table_idx: cards_on_the tables\n", e.g. "0: 1 3 3 4 5\n"

Note that if there are no cards, print "No card".

(2) all num len :  Place len cards on each table, and the value on each card is num .

For example, the instruction "all 3 4" changes the status of each table to "table_idx: 3 3 3 3\n";

(3)

place table_idx len

integer_sequence

: Place a stack of cards on table table_idx. len means the number of cards in the stack. An integer sequence integer_sequence of length len is given, in which each integer means the value on the placed card.

For example, the instruction will be like:

place 2 3

3 2 1

And the status of Table_2 will become:

2: 3 2 1

Note that if there are cards already on the target table, the status will be overridden.

(4) swap table_a table_b: Swap the cards on table_a and table_b.

For example:

If the origin status of table 0 and table 1 are:

0: 1 2 3

1: 4 5 6

after "swap 0 1", the status of the two tables become:

0: 4 5 6

1: 1 2 3

This instruction is valid even if one of the tables is empty.

(5) clear: Clean all the tables.

(6) exit: terminates

 

hint. You can use pointer array to record each table.

Input

Commands separated by a newline character.

Note that:

1 <= the value of each card <= 13

1 <= number of cards on each table <= 10000

Output

Status of each table.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss