| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12289 | after rain |
|
| 12350 | Typing |
|
Description
After rain comes sunshine and rainbow.
5/17 is the International Day Against Homophobia, Transphobia and Biphobia(國際不再恐同日), which is also the day that legislative committees trial the special law about LGBT. They eventually pass a draft that fully in line with the referendum, which make Taiwan be the first Asia country that pass a law for LGBT.
Knuckles is on his way of finding his queen. When he arrived Taiwan and see a lot of rainbow flags, he wondered that these rainbow flags might be a clue of the location of his queen. He will give some operations about these flags, you are going to help him, or he'll spit on you.
-
There are colors on these flags. The colors include: "Red", "Orange", "Yellow", "Green", "Blue", "Purple", which are the color of rainbow.
-
Knuckles has a sequence of colors. Initially, the sequence is empty.
-
Knuckles has several operations:
insert,erase1,erase2,reverse,show.-
insert <color> <dest>: means insert<color>after the location of<dest>. For example,insert Yellow 5means insert a "Yellow" after the 5-th location. If<dest>is larger than the length of the sequence, just regard it as the last location of the sequence. -
erase1 <dest>: means erase the color locates at<dest>. For example,erase1 4will erase the 4-th color in the sequence. If<dest>is larger than the length of the sequence, just regard it as the last location of the sequence. -
erase2 <color>: means erase all<color>in the sequence. For example,erase2 Purplewill erase all the "Purple" in the sequence. After the operation, There should be no "Purple" in the sequence. -
reverse <dest1> <dest2>: means reverse the elements from<dest1>to<dest2>. If the order was originally {"Yellow", "Purple", "Blue"}, after reversing, the order should become {"Blue", "Purple", "Yellow"}. If<dest1>or<dest2>is larger than the length of the sequence, just regard it as the last location of the sequence. -
show: show the sequence according to the order.
-
You are going to implement a linked list that support these operations. We have implemented show operation, what you have to do is to implement the remaining operations: insert, erase1, erase2, reverse.
Input
The first line contains an integer n, indicates the number of operations.
There are n lines below. Each line contains one operations described above.
<color> will only appear the 6 colors described above.
insert: 0 <= <dest> <= 10000
erase1: 1 <= <dest> <= 10000
reverse: 1 <= <dest1>, <dest2> <= 10000
1 <= n <= 5000
Output
When show operation is called, you should output the correct sequence after operating.
Sample Input Download
Sample Output Download
Partial Judge Code
12289.cPartial Judge Header
12289.hTags
Discuss
Description
Nderman stole a special typing machine. Because he doesn't like anybody look at him, he can only type to express himself. There're several function that this typing machine has.
(This problem is partial judge!)
void insert(Node**, char);
append one more character
charafter the cursor. Note that the cursor doesn't move after the appending.
void deletion(Node**);
delete one character after the cursor. If you reach the end of the typing, delete nothing.
void backspace(Node**);
delete one character before the cursor. If you reach the beginning of the typing, delete nothing.
void go_left(Node**, int);
move the cursor to the left for
inttimes. If you reach the beginning of the typing you should go to the end of typing and continue the moves of your cursor.
void go_right(Node**, int);
move the cursor to the right for
inttimes. If you reach the end of the typing you should go to the beginning of typing and continue the moves of your cursor.
void go_home(Node**);
move the cursor to the beginning of the typing.
void go_end(Node**);
move the cursor to the end of the typing
void show();
show all the typing.
Finish all the function except "show()"(we have done it for you).

Input
input contains several lines
First line will contain one integer n.
testcase 1 & 2:1 <= n <= 100
testcase 3 & 4:500 <= n <= 2000
Following n lines, each line contains one of the functions.
Output
If the function is show you should print all the tpying.