#1062
Unrated
KRIPTOGRAM
시간 제한
1s
메모리 제한
64MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Author: Goran Žužić

Mirko intercepted an encrypted message. Mirko knows only that specific sentence was part of the original message. Find the first occurence of this sentence inside the encrypted message. Message is encrypted by substituting every word from the original message with some (possibly the same one) word. If some word appears more than once in the original message, it will be substituted using the same word on each appearance. No two different words will have the same substitute word. Words are space seperated sequences of lowercase letters. Sentence is a sequence of consecutive words.

입력

The first line of input contains the encrypted message. This message will not contain more than 106 characters. There will be exactly one whitespace between adjacent words, and end of the line will be marked with .Trailing. Trailing is not considered to be a part of message. The following line contains the sentence that appears in the original message, and which we must find in the encrpyted message. This sentence won’t be longer than 106 characters, and will follow the same format as described above.

출력

The first and only line of output should contain the index in the encrypted message of the first word in the first occurence of given original message sentence. Solution will always exist.

예제 입력 1

a a a b c d a b c $
x y $

예제 출력 1

3

예제 입력 2

xyz abc abc xyz $
abc abc $

예제 출력 2

2

예제 입력 3

a b c x c z z a b c $
prvi dr prvi tr tr x $

예제 출력 3

3
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.