#P6509. Problem J. Count The String

Problem J. Count The String

Problem Description

Define string A match with B if A is same as B replacing the ′*′ character in B with arbitrary number of characters (possible zero).
Given string S and T.
We want to know how many non-empty substrings in S can match with T.
The substring of S is defined as $S_L$$S_{L+1}$ . . . $S_R$(1 ≤ L ≤ R ≤ |S|), two substrings are considered different if L or R are different.

Input

Input is given from Standard Input in the following format:
S
T
Constraints
1 ≤ |S|, |T| ≤ 100000
characters in S are lowercase
characters in T are lowercase or character ′*′
, and there are at most 10 ′*′ in T

Output

Print one line denotes the number of non-empty substrings in S that can match with T

aaaa a*a abba a*a
6 1