cswork / OAOpen practice workspace

Pure StorageOA #13

Find Repetitions

Estimated EasyJudge-ready

Topics (AI-labelled)Strings

Given a pattern string short_s and a text long_s, find the maximum number of times short_s repeats consecutively in long_s. No other characters may appear between occurrences. If either string is empty, the answer is 0.

Input

Two lines of uppercase English letters: the first line is short_s and the second is long_s, with lengths 0..9 and 0..999999 respectively. An empty string is given as an empty line.

Output

Output the maximum number of consecutive repetitions.

Example 1

Input:

AB
ABBAC

Output:

1

Example 2

Input:

AB
ABCABCABAB

Output:

2

Example 3

Input:


ABC

Output:

0

Editorial

Loading solution…