Virtual Keyboard
Time Limit: 1 Second Memory Limit: 32768 KB
Read the keyboard simulation commands from input, and produce the text.Input
There are multiple tests cases.
Each test case contains several lines, which may be one of the following:
Left: move the cursor to the previous character. Keep still if it is
before the first character.
Right: move the cursor to the next character. Keep still if it is
after the last character.
CtrlLeft: move the cursor to the first character of the current word;
if the cursor is already at the first character of the word, move it to the
first character of the previous word; if there is no previous word, the cursor
will keep still. The word here is defined as a continued character sequence
with no embedded whitespace.
CtrlRight: move the cursor to the first character of the next word;
if there is no next word, the cursor will keep still.
Home: move the cursor before the first character of the line.
End: move the cursor after the last character of the line.
Insert: switch the Insert/Overwrite mode. (At the beginning the mode
is Insert) In the Overwrite mode, the character input will overwrite the original
character in the text except before an enter.
Delete: delete the character after the cursor.
Backspace: delete the character before the cursor.
Blankspace: input a blank space.
Press s: input a string s. (s contains only readable characters)
Enter: input an newline character.
EndWithEndl: append an Enter after the text and terminate the test case.
EndOfInput: input is terminated with this command, do not produce output.
There will be a blank line to separate subsequent test cases.
Output
Print the text you get.
Print a blank line after each test case.
Sample Input
Blankspace Backspace Press ABC Left Left Delete End Blankspace Press . EndWithEndl Press Yeah! Enter EndWithEndl Press Welcome Blankspace Press to Blankspace Press Zhejiang Blankspace Press University Blankspace Press Online Blankspace Press Judge EndWithEndl EndOfInput
Sample Output
AC . Yeah! Welcome to Zhejiang University Online JudgeSubmit
Source: Zhejiang University Local Contest 2004