Regular Expression Matching

Same as above (regex with `.` and `*`).

Input Format

Two lines: string s, then pattern p.

Output Format

"true" or "false".

Constraints

  • 0 <= len(s), len(p) <= 1000.

Examples

Example 1:

Input:

s = "aa"
p = ".*"

Output:

true

Explanation:

".*" matches any string.

Loading...
Regular Expression Matching - Strings