编程介的小学生 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 把Excel导入MATLAB显示错误怎么解决?
    • ¥15 Java中消息和缓存如何使用
    • ¥50 易语言把MYSQL数据库中的数据添加至组合框
    • ¥20 求数据集和代码#有偿答复
    • ¥15 关于下拉菜单选项关联的问题
    • ¥20 java-OJ-健康体检
    • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
    • ¥15 使用phpstudy在云服务器上搭建个人网站
    • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
    • ¥15 vue3+express部署到nginx