Wildcard Matching (simple '?' only)

Given a string *s* and a pattern *p* of the same length containing only lowercase letters and the wildcard character `'?'` (which matches exactly one arbitrary character), determine if *s* matches *p*. Return `true` or `false`.

Input Format

Two lines: first line is string s, second line is pattern p.

Output Format

Output "true" if match, else "false".

Constraints

  • len(s) == len(p) <= 10^5.

Examples

Example 1:

Input:

s = "abc"
p = "?b?"

Output:

true

Explanation:

Pattern '?b?' matches 'abc' ('?' matches 'a' and 'c').

Loading...
Wildcard Matching (simple '?' only) - Strings