Fix the Text
Time limit1sMemory limit1024 MB
Restore each # in a text to its original character, including the letter's case, using the surrounding characters as context.
- Level
Medium4 of 10
- Topics
- String, String matching
- Solved
- No attempts yet
Problem
The input is an English text in which some characters have been replaced with #. Restore the text by filling in the characters that should have been at those positions.
Input
The input is a single line made of the characters a-z, A-Z, 0-9, the punctuation marks .,-:;!?"', and spaces. Some of these characters have been replaced with #. No test file has more than characters. The input may contain newlines, but none of them are replaced with #.
Output
Print the input text with every # replaced by the original character at that position. Changing any character other than # makes you fail that test case. Any character may have been replaced, including spaces and punctuation. If you restore a letter, its case must also be correct. Newlines can be printed however you like, since they are ignored when checking (they do not have to match the newlines in the input).