Time Limit: 2000ms
Memory Limit: 65535kb
A word is composed of only letters of the alphabet (a-z, A-Z) and may contain one hyphen (-) or more. Given a text containing words, and other characters (punctuations, numbers, symbols, etc), you are to write a program to find the longest word.
Each letter or a hyphen in a word is counted as 1. For example,
The length of Apple is 5
The length of son-in-law is 10
The length of ACM-ICPC is 8
A text may contain several lines and paragraphs but the text does not exceed 10,000 characters. No word can exceed 100 characters. The word E-N-D indicates the end of input.
Print out the longest word in small letters. If there exist several longest words, print only the first one found in the text.
ACM International Collegiate Programming Contest (abbreviated as ACM-ICPC or just ICPC) is an annual multi-tiered computer programming competition among the universities of the world. The contest is sponsored by IBM. Headquartered at Baylor University, with autonomous regions on six continents, the ICPC is directed by Baylor Professor William B. Poucher, Executive Director, and operates under the auspices of the Association for Computing Machinery (ACM). The 2012 ACM-ICPC Asia Hatyai Regional Programming Contest is held during 15-16 November 2012. It is hosted by Prince of Songkla University, Hatyai campus. E-N-D