Logo
(追記) (追記ここまで)

33653번 - Search Wizard 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB1291099091.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.

제한

예제 입력 1

buzz
8
bee buzz bee buzz bee buzz bee buz

예제 출력 1

3

예제 입력 2

aaa
5
aaaaaaaa aa a aaaa aaa

예제 출력 2

9

예제 입력 3

aba
3
aba ababa abba

예제 출력 3

3

힌트

출처

University > University of Alberta Programming Contest > UAPC 2025 > Division 2 C번

  • 문제를 만든 사람: Noah Gergel
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /