编程介的小学生 2017-03-11 15:14 采纳率: 20.5%
浏览 704
已采纳

Identity Decode

WishingBone met a ppmm in school today. He is really enthusiastic to know her name. The only information he's got is her school identity which is on her school bag. At night, WishingBone broke into the office of the principal, and found a long long list of all the students' names. It reads:

1: WishingBone ID: green_bone blue_bone red_bone
2: WishingMM ID: blue_bone green_bone red_bone
3: WishingFish ID: green_bone red_bone blue_bone
4: WashingBone ID: red_bone green_bone blue_bone
����

And he remembers the ppmm's ID is white_bone blue_bone greed_bone. Of course, he did not want to read the list through to find this ID. Well, fortunately, he found a piece of code in the recycled bin that the principle used to generate those ID's. This program reads in m and n, where m is the number of color of bones and n is the length of the ID. Then it reads in a list of colors and generates the list of possible ID's. Since WishingBone is quite poor at programming, he resorts to your help.

Input

Input consists of multiple tests. Each test starts with a line of m and n (0 < n <= m <= 12), and a list of m distinct names of colors on the next line, separated by a single space. Names are made up of up to 30 upper, lower Latin characters and the '_' character. The third line of a test contains a sequence of n names of colors, which is the school identity of the ppmm.

Process to the end of file. There will be no more than 10000 tests.

Output

For each test in the input, output a single integer - the line on which to find her name.

Sample Input

4 3
red_bone blue_bone green_bone white_bone
red_bone green_bone blue_bone
4 3
red_bone blue_bone green_bone white_bone
white_bone blue_bone green_bone

Sample Output

4
21

  • 写回答

1条回答 默认 最新

  • devmiao 2017-03-11 15:14
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多