Search Wizard
시간 제한1초메모리 제한2048 MB
공백으로 나뉜 단어들로 이루어진 문자열 S에서 짧은 단어 W가 겹쳐서 나타나도 포함해 몇 번 등장하는지 센다.
문제
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 in mind, can you figure out how many times occurs in the string ?
Note that instances of may overlap partially, but every occurance has a unique starting index in .
입력
The first line consists of a string (). The second line contains a single integer (). The third and final line contains the string consisting of words. Consecutive words are separated by a single space. The total length of all words in is at most . The only characters that will appear in and all words in are lowercase alphabetical characters a - z.
출력
Return an integer of the number of times occurs in , allowing for overlap.