Letterle
题号:NC236494
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

A new game is played by giving the user up to seven guesses to figure out a letterle (pronounced: letter-el). A letterle consists of five letters (A-Z), in a specific order. After each guess, the user is given feedback as to the correctness of their guess. Feedback is provided as a five letter string containing only the following letters: X, Y and G. 
X = letter in this position does not appear in the letterle 
Y = letter in this position appears in the letterle, but it is not in the correct position 
G = letter in this position is correct (good). 
For this problem, you will write a program that generates the feedback for up to seven guesses for a supplied letterle.

输入描述:

The first line of input contains a five character string of capital letters (A-Z) that are the letterle. The next seven lines contain guesses that the program must evaluate and generate feedback for the user. 

输出描述:

Output consists of one or more lines. For each guess, if the guess is correct, the output line is WINNER and the program should not process any more input. If the guess is incorrect, and this is the seventh guess, the output line is “LOSER”. Otherwise, the output line is a five character string where each position has one of X, Y or G (as described above). First, any position that a letter is correct, should have a G. Then, any position where a letter is not in the letterle, should contain an X. The remaining positions should contain a Y indicating the letter is correct, but in the wrong position.
示例1

输入

复制
LIMIT
ABCDE
FGHIJ
KLMNO
PQRST
LIMIT
LEMET
LAMET

输出

复制
XXXXX
XXXGX
XYGXX
XXXXG
WINNER