CAPS LOCK
Limits: 2 sec., 512 MiB
Zenyk was typing a message for Marichka. He pressed only the keys
with lowercase Latin letters and the Caps Lock key.
At the beginning Caps Lock is off. Every press of this
key switches its state: off becomes on, and on becomes off. Pressing
Caps Lock does not type anything.
When Caps Lock is off, pressing a letter key types the
corresponding lowercase letter. When it is on, pressing the same key
types the corresponding uppercase letter.
You are given the sequence of key presses in the order they were made. Help Zenyk and Marichka find out what text was typed.
Input
The first line contains one integer \(n\) – the number of key presses.
The second line contains a string \(s\) of \(n\) characters describing the sequence of
presses. A lowercase Latin letter means a press of the key with that
letter, and the character # means a press of the
Caps Lock key.
Output
Print the typed text, keeping the case of the letters.
If no letter was typed, print an empty line.
Constraints
\(1 \le n \le 1000\),
\(|s| = n\),
the string \(s\) consists only of
lowercase Latin letters from a to z and the
character #.
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 13 zenyk#mar#ich | zenykMARich |
| Input (stdin) | Output (stdout) |
|---|---|
| 8 ##a###z# | aZ |
| Input (stdin) | Output (stdout) |
|---|---|
| 5 ##### |
Notes
In the first example, Zenyk types zenyk, turns
Caps Lock on, types MAR, turns
Caps Lock off and types ich.
In the second example, the first two presses of
Caps Lock leave it off, so the lowercase letter
a is typed. The next three presses turn
Caps Lock on, so the uppercase letter Z is
typed. The last press types nothing.
In the third example, Zenyk presses only Caps Lock, so
the typed text is empty.
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|