시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 8 7 4 80.000%

문제

상근이는 오타를 자동으로 수정해주는 프로그램을 만드려고 한다.

상근이의 프로그램이 고칠 수 있는 오타는 다음과 같은 세 가지 종류이다.

1. 한 글자를 적게 썼을 때 (letter를 leter로 쓴 경우), 한 글자를 많이 썼을 때 (letter를 lettter로 쓴 경우)

2. 한 글자를 잘못 적었을 때 (letter를 ketter로 쓴 경우)

3. 인접한 두 글자의 순서가 잘못 되었을 때 (letter를 lettre로 쓴 경우)

오타 수정 프로그램의 내부에는 단어 사전이 있고, 이 사전을 이용해서 오타를 수정한다. 만약, 사용자가 입력한 단어가 사전에 없는 경우에는, 사전에 있는 단어 중 가장 비슷한 단어로 변경한다. 단어 A를 위의 세 가지 방법 중 하나를 한 번 이용해서 사전에 있는 단어 B로 바꿀 수 있을 때, 두 단어 A와 B를 비슷하다고 한다. 비슷한 단어가 사전에 없는 경우에는 알 수 없는 단어로, 오타 수정을 하지 않는다.

입력

첫째 줄에는 단어 사전에 있는 단어의 수 n이 주어진다. (n ≤ 10000) 다음 n개 줄에는 단어 사전에 있는 단어가 한 줄에 하나씩 주어진다. 다음 줄에는 오타 수정 프로그램을 이용해 수정할 단어의 수 q가 주어진다. (q ≤ 1000) 다음 q개 줄에는 수정할 단어가 한 줄에 하나씩 주어진다. 단어는 알파벳 소문자 1개~25개로 이루어져 있다.

출력

각각의 수정할 단어에 대해서, 입력으로 주어진 단어와 아래 세 가지 중 하나를 출력한다.

1. is correct: 단어 사전에 있는 단어인 경우
2. is a misspelling of <x>: 입력으로 주어진 단어가 단어 사전에 없고, <x>가 그 단어와 가장 비슷한 단어일 때. 가능한 <x>가 여러 가지 인 경우에는 입력으로 주어지는 순서가 앞선 것을 출력한다.
3. is unknown: 위의 두 경우가 아닐 때

예제 입력 1

10
this
is
a
dictionary
that
we
will
use
for
us
6
su
as
the
dictonary
us
willl

예제 출력 1

su is a misspelling of us
as is a misspelling of is
the is unknown
d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