| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 129 | 109 | 90 | 91.837% |
You adore word searches, and have been doing them since you were little. You do them so much, you started just picking out words whenever you see a string of text! With a target string $W$ in mind, can you figure out how many times $W$ occurs in the string $S$?
Note that instances of $W$ may overlap partially, but every occurance has a unique starting index in $S$.
The first line consists of a string $W$ (1ドル≤|W|≤10$). The second line contains a single integer $M$ (1ドル≤M≤10^5$). The third and final line contains the string $S$ consisting of $M$ words. Consecutive words are separated by a single space. The total length of all words in $S$ is at most 10ドル^5$. The only characters that will appear in $W$ and all words in $S$ are lowercase alphabetical characters a - z.
Return an integer of the number of times $W$ occurs in $S,ドル allowing for overlap.
buzz 8 bee buzz bee buzz bee buzz bee buz
3
aaa 5 aaaaaaaa aa a aaaa aaa
9
aba 3 aba ababa abba
3
University > University of Alberta Programming Contest > UAPC 2025 > Division 2 C번