CSES - String Matching

Xem dạng PDF

Gửi bài giải

Điểm: 1,00 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 512M
Input: stdin
Output: stdout

Nguồn bài:
https://cses.fi/problemset/task/1753
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

Given a string and a pattern, your task is to count the number of positions where the pattern occurs in the string.

Input

  • The first input line has a string of length ~n~, and the second input line has a pattern of length ~m~. Both of them consist of characters a–z.

Output

  • Print one integer: the number of occurrences.

Constraints

  • ~1 \le n,m \le 10^6~

Example Input

saippuakauppias
pp

Example Output

2

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.