← 返回 bytedance 的题目列表Regular Expression Matching (., *)
类型:online_judge
Given a string s and a pattern p, implement regex matching with the following rules:
. matches any single character
* matches zero or more of the preceding element
The match must cover the entire string s (not partial substring match).
Input: two lines s and p
Output: true or false
Constraints: 0 <= len(s), len(p) <= 2000
Examples Input:
aa
a*
Output: true
Input:
ab
.*
Output: true
Example
Input
aa
a*
Output
true