21683_Hote

2022-5-16 18:20| 发布者: Hocassian| 查看: 19| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505758016700-Problem List-采集的数据-后羿采集器.html

Pro.ID

21683

Title

Hotel

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21683

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    Last year summer Max traveled to California for his vacation. He had a great time there: took many photos, visited famous universities, enjoyed beautiful beaches and tasted various delicious foods. It is such a good trip that Max plans to travel there one more time this year. Max is satisfied with the accommodation of the hotel he booked last year but he lost the card of that hotel and can not remember quite clearly what its name is. So Max searched in the web for the information of hotels in California and got piles of choice. Could you help Max pick out those that might be the right hotel?

    输入

    Input may consist of several test data sets. For each data set, it can be format as below:

    For the first line, there is one string consisting of '*', '?' and 'a'-'z' characters. This string represents the hotel name that Max can remember. The '*' and '?' is wildcard characters. '*' matches zero or more lowercase character(s), and '?' matches only one lowercase character.

    In the next line there is one integer n ( 1 ≤ n ≤ 10000 ) representing the number of hotel Max found, and then n lines follow. Each line contains one string of lowercase character(s), the name of the hotel.

    The length of every string doesn't exceed 50.

    输出

    Description

    Last year summer Max traveled to California for his vacation. He had a great time there: took many photos, visited famous universities, enjoyed beautiful beaches and tasted various delicious foods. It is such a good trip that Max plans to travel there one more time this year. Max is satisfied with the accommodation of the hotel he booked last year but he lost the card of that hotel and can not remember quite clearly what its name is. So Max searched in the web for the information of hotels in California and got piles of choice. Could you help Max pick out those that might be the right hotel?

    Input

    Input may consist of several test data sets. For each data set, it can be format as below:

    For the first line, there is one string consisting of '*', '?' and 'a'-'z' characters. This string represents the hotel name that Max can remember. The '*' and '?' is wildcard characters. '*' matches zero or more lowercase character(s), and '?' matches only one lowercase character.

    In the next line there is one integer n ( 1 ≤ n ≤ 10000 ) representing the number of hotel Max found, and then n lines follow. Each line contains one string of lowercase character(s), the name of the hotel.

    The length of every string doesn't exceed 50.

    Output

    For each test data set, just simply output one integer in a line telling the number of hotel in the list whose name matches the one Max remembered.

    Sample Input

    herbert
    2
    amazon
    herbert
    ?ert*
    2
    amazon
    herbert
    *
    2
    amazon
    anything
    hertber?
    2
    amazon
    herber

    Sample Output

    1
    0
    2
    0

    Source

    样例输入

    herbert
    2
    amazon
    herbert
    ?ert*
    2
    amazon
    herbert
    *
    2
    amazon
    anything
    hertber?
    2
    amazon
    herber

    样例输出

    1
    0
    2
    0

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部