#C6811. Taco Pattern Matching
Taco Pattern Matching
Taco Pattern Matching
You are given two strings s and p. The string p is a pattern which may include lowercase letters and the wildcard character \( ? \). The wildcard \( ? \) can match any single lowercase letter.
The matching process is defined as follows:
- If the lengths of s and p are not equal, the answer is
NO
. - Otherwise, for every index \( i \) (0-indexed), the character in s must either be equal to the character in p or the corresponding character in p must be \( ? \).
If both conditions are satisfied, output YES
, otherwise output NO
.
Note: All comparisons are case-sensitive and the matching is exact.
inputFormat
The input is provided via standard input (stdin) and consists of two lines:
- The first line contains the string
s
. - The second line contains the pattern string
p
.
outputFormat
The output should be written to standard output (stdout) and consist of a single line containing either YES
if the string s
matches the pattern p
, or NO
otherwise.
ababcdc
a?a?cdc
YES