시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 26 23 23 95.833%

문제

소문자 b와 d나 p와 q는 서로 거울상 관계이다. 또한 i,o,v,w와 x는 모두 자신과 거울상 관계이다. 이 외에도 몇가지 거울상 관계인 문자들이 존재하지만, 이 문제에서는 위에서 언급한 문자들만 거울상 관계로 생각하도록 하자.

이러한 대칭성으로 인해 위의 문자들로 이루어진 단어들은 거울에 비친 모습을 보고 거울에 반사되기 전 모습을 유추하는 것이 가능하다. 예를들어, 'boxwood'는 반사되기 전 'boowxod', 'ibid'는 반사되기 전 'bidi'라는 단어일 것이다. 몇 단어들이 주어질 때, 거울에 비춰지기 전 모습을 표현할수 있는지 판단하여라.

입력

입력으로 한 줄에 하나씩 소문자로만 이루어진 단어가 주어진다. 입력의 마지막줄에는 # 한 글자가 입력으로 주어진다.

출력

각 줄마다 거울에 비춰지기 전 모습이 표현가능하다면 그 거울상의 모습을 출력하고 그렇지 않다면 'INVALID'를 출력한다.

예제 입력 1

boowxod
bidi
bed
bbb
#

예제 출력 1

boxwood
ibid
INVALID
ddd

힌트

W3sicHJvYmxlbV9pZCI6IjQ1ODMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjNzBcdWM2YjhcdWMwYzEiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YzE4Y1x1YmIzOFx1Yzc5MCBiXHVjNjQwIGRcdWIwOTggcFx1YzY0MCBxXHViMjk0IFx1YzExY1x1Yjg1YyBcdWFjNzBcdWM2YjhcdWMwYzEgXHVhZDAwXHVhY2M0XHVjNzc0XHViMmU0LiBcdWI2MTBcdWQ1NWMgaSxvLHYsd1x1YzY0MCB4XHViMjk0IFx1YmFhOFx1YjQ1MCBcdWM3OTBcdWMyZTBcdWFjZmMgXHVhYzcwXHVjNmI4XHVjMGMxIFx1YWQwMFx1YWNjNFx1Yzc3NFx1YjJlNC4gXHVjNzc0IFx1YzY3OFx1YzVkMFx1YjNjNCBcdWJhODdcdWF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