Deleting words and characters.
Statement
Goal
We all make mistakes when typing. Computers provide us with the backspace key, represented asBut did you know that, in Unix terminals (like on Linux and macOS), you can also delete the last typed word using a single key combination? That key combination is Ctrl+W, represented as
Exactly how
Take in the keystrokes with
Input
Line 1: A string containing the keystrokes with ^H and ^W.
Output
Line 1: The resulting text.
Constraints
Input string fits in a tweet (length is no longer than 280 characters).
Example
Input
Hello^H^H^H^Hi
Output
Hi
Game modes
Fastest, Shortest
Test cases
Hi Test
Input
Hello^H^H^H^Hi
Output
Hi
Validator 1 Validator
Input
hello^H^H^H^Hi
Output
hi
CodinGame Test
Input
Coding^HGame
Output
CodinGame
Validator 2 Validator
Input
Clash of c^HCode
Output
Clash of Code
Longer message Test
Input
Could^WWould you liek^H^Hke to solve a ^Wsome challenge?^Hs?
Output
Would you like to solve some challenges?
Validator 3 Validator
Input
Could^WWould you liek^H^Hke to solve a ^Wsome challenge?^Hs??
Output
Would you like to solve some challenges??
Hey ! Test
Input
Hey you^W!
Output
Hey !
Validator 4 Validator
Input
hey you^W!
Output
hey !
Hey! Test
Input
Hey you^W^H!
Output
Hey!
Validator 5 Validator
Input
hey you^W^H!
Output
hey!
Complicated Test
Input
This one is qui^^H^^^^Wpri^Het^h^H^Hty k^Hcomplicated.
Output
This one is pretty complicated.
Validator 6 Validator
Input
this one is qui^^H^^^^Wpri^Het^h^H^Hty k^Hcomplicated.
Output
this one is pretty complicated.
^_^ Test
Input
^W^H^W^HGreat job! ^_^
Output
Great job! ^_^
Validator 7 Validator
Input
^W^H^W^Hgreat job! ^_^
Output
great job! ^_^
Solution language
Solution
Stub generator input