|Online MIPT programming contest||РУССКИЙ|
Time limit = 3 second(s)A given regular expression consists of a sequence of obligatory lexems and optional elements. Each optional element is a regular expression too. The regular expression has the following syntax:
regexp ::= ( lexem | '[' regexp ']' ) +
Lexem can be one of ascii characters except of square brackets.
For example, regular expression "a[b]" means "a" or "ab". Example of more complex regular expression:
You must give an answer whether the given string S matches against the given regular expression R. Maximal length of the string and regular expression does not exceed 1000 characters. The regualar expression is correct.
Input Two lines. The first contains S, the second contains R.
Output YES in case of matcing and NO in other case.
17 December 2003
© acm.mipt DevGroup
The page was generated in 200ms