编程介的小学生 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 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分