Pattern Matching#3883

Pattern Matching

5 seconds
256 megabytes
Easy

Pattern is a nonempty string that may contain lowercase letters of the Latin alphabet and the special character '*' (star).

We will say that a string matches the pattern if and only if there is a way to replace the stars in with (possibly empty) sequences of lowercase letters so that the result equals . For example, the string aadbc matches the pattern a*b*c, as we can obtain the string from the pattern by replacing the first star in the pattern with ad and the second one with the empty string. On the other hand, the string abcbcb does not match this pattern.

Given a non-empty string consisting of lowercase Latin letters, count the number of cyclic shifts of that match the given pattern .

Input

The first line of input contains the pattern ( to characters long). The second line contains the string ( to characters long).

Output

The output should consist of a single integer, the number of cyclic shifts of that match the pattern .

Examples

Example 1

Loading
Loading