#K91452. Case Insensitive Regular Expression Matching

    ID: 37978 Type: Default 1000ms 256MiB

Case Insensitive Regular Expression Matching

Case Insensitive Regular Expression Matching

You are given a string s and a pattern p with two special characters:

  • . matches any single character.
  • * matches zero or more occurrences of the immediately preceding character.

The matching should be case insensitive and the entire string s must match the pattern p completely.

The input consists of multiple test cases. Each test case is given on a separate line containing s and p separated by a space. The input is terminated by a line with the text END. For each test case output True if the string matches the pattern and False otherwise.

Note: You are not allowed to use any external libraries beyond the built-in regex functions of your language.

inputFormat

The input is read from standard input (stdin). It consists of multiple lines. Each line (except the last) contains two tokens separated by a single space: the string s and the regex pattern p. The end of input is denoted by a line containing END.

outputFormat

For each test case (i.e., for each line except the terminating line), output a single line to standard output (stdout). Print True if the string s matches the pattern p completely (in a case insensitive manner), otherwise print False.

## sample
a a
END
True

</p>