Regular Expression Matching
1. ‘.’ matches to any single character. 2. ‘*’ matches to zero or more of the preceding element.
1. You have to match the entire string with the pattern given. 2. Both the strings, 'S' and 'P' contain only lower-case alphabets. 3. Only the pattern will contain additional characters ‘*’ and ‘.’ along with alphabets.
The first line contains a single integer T representing the number of test cases. The one and only line of each test case contains two space-separated strings 'S' and 'P' respectively.
For each test case, print a single line containing “true” if the string matches the pattern, else print ”false”. The output of every test case is printed in a separate line.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10 1 <= N <= 1000 1 <= M <= 1000 Where 'T' is the number of test cases, ‘N’ is the length of the input string to be matched, and ‘M’ is the length of the pattern 'P'. Time limit: 1 sec.