CT349

The Pattern Count of Amberfield

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Baron the tallyman watches over the wheat plains of Amberfield's stores of scrolls. A careful computation stands between order and chaos. Task: Count how many times string t occurs inside s (occurrences may overlap). Input format: Two lines: string s, then pattern t. Output format: Print the occurrence count. Constraints: 1 <= |t| <= |s| <= 177; lowercase letters.

Example 1:

Input: bswkgkdjvguoiuxfjtczdlypnxwzitumlgugcitwkhdlnffjojhfdjfhwudidzlvextzrmejhwwjgjesuvmgundshcshxfrlxxqytnlvtjueebfcjfjmulptqnylzuonxrnbjfyncxekorxkpjvlffotcqztdw nfahv
Output: 0

Example 2:

Input: safhgebsxrelzdlqyqilrsleewwdvwpoozdinxphrghwzwnlzswpuiinhmfzcbtovwmngqfiqjwlbuoxzpvqtutqjneogsvtbdkzolgrisgjxfngoadwhkdywugjeblfpuufyclnihxmlnhauqfbzngpuxqzvuu zpv
Output: 1

Example 3:

Input: ajqzgljejffnwsxbqvxfhycnkajamiqbzlezrfcbfkvjppwwoirdlqyqcofswnicsbovrtoipaknxkqqkxchgjjqfmpppivwsorsygcernkoyqswofdoognopfzqghkdibbhfozwprsfzwwehiggyblskpkjla zr
Output: 1

Constraints:

1 <= |t| <= |s| <= 177; lowercase letters.

Loading...
Test Cases:No test cases
No test cases available.