608. Pattern Matching Game

0

Easy

Given a text string 'str' and a wildcard pattern 'pattern', the wildcard pattern can contain the characters '?' and '*'. The '?' character matches any single character, while the '*' character matches any sequence of characters (including an empty sequence). Determine whether the given text string matches the pattern.

Input Format

Each test case consists of two strings. The first line contains the text string, and the second line contains the pattern.

Output Format

Print '1' if the string matches the pattern, otherwise print '0'.

Example

Input

aa a*a

Output

1

Constraints

Size(str)*Size(pattern) must be less than 100000000
Loading...

View Submissions

Console