|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||32||25||20||80.000%|
Many ‘IQ’ tests have questions of the form: king : queen :: president : ?, where the ‘correct’ answer (in USA anyway) is ‘first lady’, which says a lot about IQ tests and western culture. Because these tests are so culture laden, psychologists at the University of Northern Southwestland have devised a similar test, based on the positional difference between the letters in the words. Thus a typical problem might be: cat : dog :: emu : ? to which the answer is ‘fah’ because to go from ‘cat’ to ‘dog’ you advance the first letter by 1, the second by 14, and the third by 13. So ‘cat’ to ‘dog’ = ‘emu’ to ‘fah’. However, these same psychologists are somewhat arithmetically challenged, so they are never quite sure that they have got the right answer. This is where you come in.
Write a program that will read in triples of words such as the ones above and determine the fourth word according to the rules outlined. Consider that the lower case alphabet wraps around at both ends, i.e. ‘a’ succeeds ‘z’ and ‘z’ precedes ‘a’.
Input will consist of a series of problems. Each problem will consist of three words on a line (see the definition of a word in the Preamble), separated by single spaces. All the words on a line will be the same length (not more than 20 letters), but words on different lines may be of different lengths. Input will be terminated by a line consisting of a single ‘#’ character.
Output will consist of one line for each line of input consisting of the three words given in the input followed by the ‘answer’, all separated by single spaces. Note that the answer must also be a word, i.e. it must be of the same length as the three input words and consist only of lower case letters.
cat dog emu frog wolf bear #
cat dog emu fah frog wolf bear sbxq