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!

UVa-409-Excuses, Excuses!

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

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

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

UVA 题目409 - Excuses, Excuses!

Excuses, Excuses!  Judge Ito is having a problem with people subpoenaed for jury duty g...
  • SJF0115
  • SJF0115
  • 2013年04月29日 14:13
  • 2746

uva 409 Excuses, Excuses!

简单字符串题目,有一点集合的小应用 #include #include #include #include #include using namespace std; #define...

HDU 1606(POJ 1598 UVA 409) Excuses, Excuses!(字符串匹配处理)

Excuses, Excuses! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Other...
  • YJX_xx
  • YJX_xx
  • 2014年07月21日 16:19
  • 566

UVa 409 Excuses! Excuses!

题目要注意的地方: 1)不区分大小写! 2)判断一个单词是否合法:前后是空格或者是非字母字符。比如8342364823abcd$^%$&^^* 那么,里面那个abcd也算是一个合法的单词。 原文...
  • gneveek
  • gneveek
  • 2011年10月06日 19:32
  • 750

UVA - 409 - Excuses, Excuses

#include #include #include #include #include #include using namespace std; const int MAXN = 2...

uva409 - Excuses, Excuses!

Judge Ito is having a problem with people subpoenaed for jury duty giving rather lame excuses in ord...

uva - 409 - Excuses, Excuses!

#include #include void Creat_K_E(char (*k)[50], int m, char (*e)[100], int n) { int i = 0; for ...

UVa 409 - Excuses, Excuses!

看题目的时候,我在想一个问题,这个问题的字母的大小写是不是等价的当看到第一个样例后就会知道,这个问题的大小写也是的等价的。 对于一个字符串中重复出现的单词,不进行重复计数。还有就是尽量把数组定义的大一...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:409 - Excuses, Excuses!
举报原因:
原因补充:

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