|
||||||||||
Problem J. Count The StringTime Limit: 3000/1500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 135 Accepted Submission(s): 7 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 Sample Input
Sample Output
Source | ||||||||||
|