Hide those letters
Time limit1sMemory limit128 MB
The program replaces every occurrence of two given letters in both cases with underscores.
- Level
Easy1 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
Mrs Jones teaches at a primary school, and she thought of a way to help her pupils learn to spell. She removes certain letters from a sentence and puts underscore characters in their place. The children then write the right letters into the blanks. To start with, Mrs Jones picks two different letters from a sentence, say a and e, and the children work out whether each underscore stands for an 'a' or an 'e'.
Input
The input holds several cases and ends with a line containing just # #. Each case begins with a line holding two lowercase letters separated by a space. The next line holds an integer , the number of text lines in the case. Each of the following lines holds a line of text of up to 255 characters.
Output
For each case, first print the case number in the form Case k, where counts from 1 in case order. Below it print one line for every line of text in that case. The text is the same as the input, except that every occurrence of either of the two letters becomes the underscore character _. The two letters are given in lowercase, but their uppercase forms must be replaced as well. Print a blank line between cases.