DWITE Online Computer Programming Contest, February 2011, Problem 1
Colour has often been added to words to make them seem more attractive or distinct (take the Google logo for example). However, taking a look at coloured words under coloured light makes the letters in the word that has the same colour as the light seem invisible. For example, say I have the word
DWITE, and its letters are coloured blue, red, red, green and blue respectively. If you looked at the word under red light, you would only see
D__TE (note the underscores, representing positions, where the
I have been). Given coloured words and the light they are observed under, determine what you would see.
The input will contain 5 test cases. The first line of each test case consists of two words (strings with no spaces) and , representing the word and the colour of each letter of the word respectively (so the th letter of determines the colour of the th letter of , where the possible colours are
b for blue,
r for red, and
g for green). The next line contains a string , representing the colour of the light. consists of either a
g (representing blue, red and green), or any combination of these letters separated by
The output should consist of 5 lines, where each line contains the given word as it appears under the given light. Invisible letters are to be represented with
Note: There are 3 under scores after
Compu in the third line of output, and the last line of output contains 5 under scores. It is also assumed that combined colours remove letters of either individual component in the combination.
Sample rggbbr b DWITE brrgb r Computer bbbbbrrg r+g February brbrbrbr g Sweet brgbr r+g+b
Sam__e D__TE Compu___ February _____