409 - Excuses, Excuses!

原创 2011年01月09日 12:48:00

Excuses, Excuses! 

Judge Ito is having a problem with people subpoenaed for jury duty giving rather lame excuses in order to avoid serving. In order to reduce the amount of time required listening to goofy excuses, Judge Ito has asked that you write a program that will search for a list of keywords in a list of excuses identifying lame excuses. Keywords can be matched in an excuse regardless of case.

 

Input

Input to your program will consist of multiple sets of data.

 

  • Line 1 of each set will contain exactly two integers. The first number ( tex2html_wrap_inline30 ) defines the number of keywords to be used in the search. The second number ( tex2html_wrap_inline32 ) defines the number of excuses in the set to be searched.
  • Lines 2 through K+1 each contain exactly one keyword.
  • Lines K+2 through K+1+E each contain exactly one excuse.
  • All keywords in the keyword list will contain only contiguous lower case alphabetic characters of length L ( tex2html_wrap_inline42 ) and will occupy columns 1 through L in the input line.
  • All excuses can contain any upper or lower case alphanumeric character, a space, or any of the following punctuation marks [SPMamp".,!?&] not including the square brackets and will not exceed 70 characters in length.
  • Excuses will contain at least 1 non-space character.

Output

For each input set, you are to print the worst excuse(s) from the list.

 

  • The worst excuse(s) is/are defined as the excuse(s) which contains the largest number of incidences of keywords.
  • If a keyword occurs more than once in an excuse, each occurrance is considered a separate incidence.
  • A keyword ``occurs" in an excuse if and only if it exists in the string in contiguous form and is delimited by the beginning or end of the line or any non-alphabetic character or a space.

For each set of input, you are to print a single line with the number of the set immediately after the string ``Excuse Set #". (See the Sample Output). The following line(s) is/are to contain the worst excuse(s) one per line exactly as read in. If there is more than one worst excuse, you may print them in any order.

 

After each set of output, you should print a blank line.

 

Sample Input

 

5 3
dog
ate
homework
canary
died
My dog ate my homework.
Can you believe my dog died after eating my canary... AND MY HOMEWORK?
This excuse is so good that it contain 0 keywords.
6 5
superhighway
crazy
thermonuclear
bedroom
war
building
I am having a superhighway built in my bedroom.
I am actually crazy.
1234567890.....,,,,,0987654321?????!!!!!!
There was a thermonuclear war!
I ate my dog, my canary, and my homework ... note outdated keywords?

 

Sample Output

 

Excuse Set #1
Can you believe my dog died after eating my canary... AND MY HOMEWORK?

Excuse Set #2
I am having a superhighway built in my bedroom.
There was a thermonuclear war!
 
版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

UVA409 - Excuses, Excuses!

问题描述n个关键字,m个句子,输出句子中存在最多关键字的句子(如果关键字数量相同,则按顺序输出)。思路将所需的字符全部转换成小写,用一个数组g来存储一个单词,然后判断是否为英文字母,如果是,则存储,否...

Uva 409 Excuses, Excuses!

Excuses, Excuses!  Judge Ito is having a problem with people subpoenaed for jury duty giv...

UVA 409 - Excuses, Excuses!

满满的都是泪啊. 一开始没思路,没想到多个key要怎么存..后来参考了一下别人的代码,知道可以用二维数组来存...也就在同时,我的悲剧开始了. 那个代码是可以AC的. 一般OJ不会出错的对吧.....

UVa 409 - Excuses, Excuses!

Excuses, Excuses!  Judge Ito is having a problem with people subpoenaed for jury duty giv...

UVa-409-Excuses, Excuses!

AOAPC I: Beginning Algorithm Contests (Rujia Liu) :: Volume 1. Elementary Problem Solving ::Stri...

UVA 409 Excuses, Excuses!

输入一些单词,统计之后输入的句子分别含多少个单词,输出最多的,如果有多个,就都输出,任意序都行。 #include #include #include #include #include #incl...

uva409 Excuses, Excuses!(字符串处理)

题目戳这里 题目大意: 给出一定量的关键词与一定量的句子,查找含有关键词量最多的句子,并输出,如果是多个句子,一并输出。 注意: 1.关键词在句子中出现必须是单词的形式,关键词是ab的时候在句...

UVA - 409 Excuses, Excuses!

uva 409 Excuses, Excuses!

uva 409 Excuses, Excuses! 题目大意:给出一些借口,再给出一些句子。输出包含最多借口的句子。 注意:有1个以上并列最多时,按输入顺序输出。 借口不能为句子中单词的子串,这样...

UVA 题目409 - Excuses, Excuses!

Excuses, Excuses!  Judge Ito is having a problem with people subpoenaed for jury duty g...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)