DWITE Online Computer Programming Contest
February 2011
Problem 1
Colourful Words

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 'W' and 'I' have been). Given coloured words and the light they are observed under, determine what you would see.

The input file DATA1.txt will contain 5 test cases. The first line of each test case consists of two words (strings with no spaces) W and C, representing the word and the colour of each letter of the word respectively (so the ith letter of C determines the colour of the ith letter of W, where the possible colours are 'b' for blue, 'r' for red, and 'g' for green). The next line contains a string L, representing the colour of the light. L consists of either a 'b', 'r', or 'g' (representing blue, red and green), or any combination of these letters separated by '+'s.

The output file OUT1.txt 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 _ underscores.

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 Input:
Sample rggbbr
b
DWITE brrgb
r
Computer bbbbbrrg
r+g
February brbrbrbr
g
Sweet brgbr
r+g+b
		        
Sample Output:
Sam__e
D__TE
Compu___
February
_____