2217. Pattern Matcher

单点时限: 2.0 sec

内存限制: 256 MB

So this guy walks in a bar, and there’s this tiny man who plays a tiny piano… yadda yadda yadda, left as an exercise to the reader.

Two strings, one of which contains special characters, must be matched against each other. The test string can contain all characters in the range A-Z (both lower and upper case), but no whitespace or delimiter or numerical characters. The joker string can additionally contain the following meta characters:

  1. a ’+’ sign matches one occurence of any other character

  2. a ’*’ sign matches a substring of arbitrary length.

输入格式

The input consists of multiple test cases.

For every test case a text string pair, separated by a single blank, is given. The first string contains the test string, the second the joker string. You can assume that both strings conform to their specifications above.

all the strings length is no more than 100;

Input is terminated by EOF.

输出格式

The output gives for each of the input pairs the number of possible matches between the two strings each in a separate line.

样例

Input
abcde abcde
abcde +a*b+de
AB ***
Output
1
0
6

1 人解决,6 人已尝试。

1 份提交通过,共有 9 份提交。

9.9 EMB 奖励。

创建: 16 年,5 月前.

修改: 7 年,4 月前.

最后提交: 5 年,2 月前.

来源: TU Darmstadt Programming Contest 1999

题目标签