시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 (추가 시간 없음) 1024 MB225419.048%

문제

The NIS spy network has decided to change the phone number from its headquarters every day as an extra security measure. To inform the spies about the new number, a sequence of words is given only to the spies (a total of 10 words), which they must then compare to a sequence of words from a newspaper, word by word. The comparison of words is done by finding the minimum number of operations required to make the first word identical to the second word. The possible operations that can be performed on the first word are the following:

  • Operation 1 (INSERT): Insert any character before or after any index of str1
  • Operation 2 (REMOVE): Remove a character from str1
  • Operation 3 (REPLACE): Replace a character at any index of str1 with some other character.

입력

The first line contains the number (N) of words in the newspaper paragraph that will be used. The second line contains the 10 positions from the words that must be used from the given paragraph. The third line contains the 10 initial words of the secret phrase. The fourth line provides the N words of the paragraph.

출력

The phone numbers found separated by spaces.

예제 입력 1

15
1 3 2 5 6 8 15 10 11 12
hello I cannot wait to start coding for this problem
amidst the tranquil forest a cascade of colors painted the trees in a mesmerizing dance

예제 출력 1

6 8 6 3 7 5 5 3 3 7

힌트

Short explanation: In the above example, the edit distance should be calculated between the words: hello ↔ amidst (6), I ↔ tranquil (8), cannot ↔ the (6), wait ↔ a (3), to ↔ cascade (7), start ↔ colors (5), coding ↔ dance (5), for ↔ the (3), this ↔ trees (3), problem ↔ in (7)