시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 11 | 1 | 1 | 50.000% |
Given a dictionary of obscene words S1, S2, ..., Sn and text T, find if text contains one of obscene words as subsequence. If it does, find smallest prefix of T that contains such subsequence.
First line of input contains one integer n - number of words in dictionary. Following n lines contain words from dictionary, one per line. Each word consists of ASCII characters with codes from 32 to 127, inclusive. Next line contains text T, consisting of the same set of characters. Total length of all words in dictionary doesn't exceed 100 KiB (100 x 210bytes). Total size of input file doesn't exceed 1 MiB (220bytes).
Output NO if there is no obscene subsequence in the text. Otherwise output YES <X>, where X is the length of smallest prefix of T that contains some obscene subsequence.
2 hello world abracadabra
NO
2 hello world zzzheluuuulottt
YES 12