407414: GYM102785 J R u really ready?

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

J. R u really ready?time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You have two strings pattern $$$p$$$ and text $$$t$$$. Strings consist of only latin lower case characters. In addition pattern may include characters $$$+$$$ which means that a previous symbol should be repeated one or more times and characters $$$*$$$ in that case previous symbol should be repeated any number times.

Your task is to answer on the question does text $$$t$$$ matche to pattern $$$p$$$.

For example, text "eboooy" matches to patterns "ebo+y", "ebo*o*o+y+", but doesn't to "ebb*oy" or to "ebooo".

Input

The first string of input consists pattern $$$p$$$, the second one consists text $$$t$$$. Both strings have non-negative length. It's guaranteed that $$$p$$$ is a valid in the meaning there are no two $$$+$$$ or $$$*$$$ in a row and the first symbol of $$$p$$$ is latin lower case character. Each string can't be longer than $$$1000$$$ characters.

Output

Print Yes if text matches pattern, otherwise print No.

ExamplesInput
pa*t+ern
pattern
Output
Yes
Input
c*cp+p
cpp
Output
Yes
Input
b+b
b
Output
No

加入题单

上一题 下一题 算法标签: