eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Match Maker

Match Maker

In Computer Science, pattern matching is the act of checking if a certain sequence conforms (matches) a given pattern. Patterns are usually specified using a language based on regular expression. In this problem, we'll use a simple regular expression to express patterns on sequences of decimal digits. A pattern is a sequence of one or more decimal digits '\textbf{0}' ...'\textbf{9}', asterisks '\textbf{*}', and hash signs '\textbf{#}'. A '\textbf{*}' denotes a sequence of an even number of digits, whereas a '\textbf{#}' denotes a sequence of an odd number of digits. For example, the pattern "\textbf{129}" only matches the sequence \textbf{129}. The pattern "\textbf{1*3}" matches all sequences beginning with \textbf{1}, ending with \textbf{3}, and having an even number of decimal digits between the first and last digits. As another example, the pattern "\textbf{#55}" matches the sequences \textbf{155}, \textbf{12355}, \textbf{1234555}, but none of the sequences \textbf{55}, \textbf{1255}, \textbf{123455}. Your task is to write a program to find if a given sequence matches a given pattern. \InputFile Your program will be tested on one or more data sets. Each data set contains a single pattern and one or more sequences to match. The first line of each data set specifies the pattern, and the remaining lines specify the sequences to match against that pattern. The end of a data set (except the last) is identified by the word "\textbf{END}" (without the double quotes). The end of the last data set is identified by the word "\textbf{QUIT}". All lines are \textbf{100000} characters long or shorter. \OutputFile \textbf{k.s. result} Where \textbf{k} is the test case number (starting at one,) and \textbf{s} is the sequence number (starting at one within each test case,) and \textbf{result} is either the word "\textbf{match}" if the given string matches the pattern, or the word "\textbf{not}" if it doesn't.
Лимит времени 1 секунда
Лимит использования памяти 64 MiB
Входные данные #1
129
1299
129
1129
END
1*3
123
1223
END
#55
155
12355
55
1255
QUIT
Выходные данные #1
1.1. not 
1.2. match 
1.3. not 
2.1. not 
2.2. match 
3.1. match 
3.2. match 
3.3. not 
3.4. not