Regular Expression Matching

easy
1. You will be given an text string S and a pattern P
  2. You need to check if string matches the regular expression P for quantifiers: . and *
  3. Where: 
      a) . matches any single character
      b) * matches 0 or more occurence of preceeding character
  3. Return true if match successful else, false
  4. Input and output is handled for you
  5. It is a functional problem ,please do not modify main()

Input Format

Input is handled for you

Output Format

Output is handled for you

Constraints

s could be empty and contains only lowercase letters a-z
  p could be empty and contains only lowercase letters a-z, and characters like . or *

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
4
Output
5
Previous
Cherry Pickup
Next
Rod Cutting

Related Questions