eolymp
bolt
Try our new interface for solving problems

ls

You are implementing an operating system, and now need to write a program to list fi les in a directory: '\textbf{ls}'. You want the user to be able to list only les that match a given pattern that can include wildcards (\textbf{*}), for example \textbf{*.c}. A wildcard matches zero or more characters of any kind. \InputFile The first line contains a string \textbf{P}, containing \textbf{1-100} characters '\textbf{a}'-'\textbf{z}', '\textbf{*}' and '\textbf{.}'. This is the pattern. The second line contains an integer \textbf{N}, \textbf{1} ≤ \textbf{N} ≤ \textbf{100}, which is the number of fi les in the directory. Then follows \textbf{N} lines containing the names of the fi les in the directory. Each line is a string containing \textbf{1-100} characters '\textbf{a}'-'\textbf{z}' and '\textbf{.}'. \OutputFile The output shall consist of the fi lenames that match the pattern, \textbf{P}, each on its own line, in the same order that they were given as input.
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 64 MiB
Giriş verilənləri #1
*.*
4
main.c
a.out
readme
yacc
Çıxış verilənləri #1
main.c
a.out
Mənbə 2011 Nordic Collegiate Programming Contest, 1 Октября, Задача E