编程介的小学生 2019-04-19 15:16 采纳率: 20.5%
浏览 530

模仿通配符的定义实现字符串的模糊查询问题,怎么采用C程序的语言的编写的思路实现

Problem Description
WisKey downloaded much software in winter vacation, and the disk was in a state of confusion. He wastes many times to find the file everyday. So he wants a tool to help him do this work.
The file name consists of lowercase letters.
The name pattern is a string of lowercases, '?'s and '*'s. In a pattern, a '?' matches any single lowercase, and a '*' matches none or more lowercases.
Let’s do this~

Input
The first line of input contains two integers N (0 < N <= 10000) and M (0 < M <=100), representing the number of file names and the number of word patterns.
Each of the following N lines contains a file name. After those, each of the last M lines contains a name pattern.
You can assume that the length of patterns will not exceed 6, and the length of file names will not exceed 20.
There are multiple cases in the data file, process to end of file.

Output
For each pattern, print a line contains the number of matched file names.
If there is no file name that can match the pattern, print "Not match".

Sample Input
4 5
this
the
an
is
t*
?h*s
??e*
*s
e

Sample Output
2
1
1
2
Not match

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何用stata画出文献中常见的安慰剂检验图
    • ¥15 c语言链表结构体数据插入
    • ¥40 使用MATLAB解答线性代数问题
    • ¥15 COCOS的问题COCOS的问题
    • ¥15 FPGA-SRIO初始化失败
    • ¥15 MapReduce实现倒排索引失败
    • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
    • ¥15 找一位技术过硬的游戏pj程序员
    • ¥15 matlab生成电测深三层曲线模型代码
    • ¥50 随机森林与房贷信用风险模型