#C6811. Taco Pattern Matching

    ID: 50613 Type: Default 1000ms 256MiB

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:

  1. The first line contains the string s.
  2. 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.

## sample
ababcdc
a?a?cdc
YES