F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Wildcard

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others)
Total Submission(s): 2665    Accepted Submission(s): 460


Problem Description
When specifying file names (or paths) in DOS, Microsoft Windows and Unix-like operating systems, the asterisk character (ˇ°*") substitutes for any zero or more characters, and the question mark (ˇ°?") substitutes for any one character.
Now give you a text and a pattern, you should judge whether the pattern matches the text or not.
 

Input
There are several cases. For each case, only two lines. The first line contains a text, which contains only lower letters. The last line contains a pattern, which consists of lower letters and the two wildcards (ˇ°*", "?").
The text is a non-empty string and its size is less than 100,000, so do the pattern.

We ensure the number of ˇ°?ˇ± and the number of ˇ°*ˇ± in the pattern are both no more than 10.
 

Output
Output ˇ°YESˇ± if the pattern matches the text, otherwise ˇ°NOˇ±.
 

Sample Input
abcdef a*c*f
 

Sample Output
YES
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 06:48:06, Gzip enabled