14198 - CS website part 2   

Description

The problem is modified from "Cardcaptor Sakura2".

In "Cardcaptor Sakura2", all the values are integers, but in this problem, you need to store chars on each table.

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

Given a command S, you have to follow the instructions below:

(1) print: print the status of each table with the format :"table_idxcontents_on_the tables\n", e.g. "0: abc\n"

Note that if there are no contents, print "No Contents".

(2) all c len :  Place len chars on each table, and the value is c .

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

(3)

place table_idx

STRING

: Place a string STRING on table table_idx.

For example, the instruction will be like:

place 2

Hello

And the status of Table_2 will become:

2: Hello

Note that if there are contents 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: abc

1: def

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

0: def

1: abc

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

(5) clear: Clean all the tables.

(6) exit: terminates

(7) shiftleft: Move the contents on each table to its left. For table 0, move the contents to table 9.

For example:

If the origin status of tables is:

0: aaa

1: bbb

2: ccc

3: ddd

4: eee

5: fff

6: ggg

7: hhh

8: iii

9: jjj

after the shift, it'll become:

0: bbb

1: ccc

2: ddd

3: eee

4: fff

5: ggg

6: hhh

7: iii

8: jjj

9: aaa

(8) shiftright: Move each pile of cards to its right. For table 9, move the contents to table 0.

For example:

If the origin status of tables are:

0: aaa

1: bbb

2: ccc

3: ddd

4: eee

5: fff

6: ggg

7: hhh

8: iii

9: jjj

after shiftright, it'll become:

0: jjj

1: aaa

2: bbb

3: ccc

4: ddd

5: eee

6: fff

7: ggg

8: hhh

9: iii

Input

Commands separated by a newline character.

Note that:

The maximum length of each content should be less than 10001.

Each content is only composed of digits and letters (e.g., 1 or "A").

Output

Status of each table and you have to print a newline characters at the end of each line.

Note that you don't have to print space between chars on each table.

Sample Input  Download

Sample Output  Download

Tags




Discuss