Problem J Longest Word

Problem J
Longest Word
,
) and may contain one hyphen (-)
A word is composed of only letters of the alphabet (
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
is
5
The length of
is
10
The length of
is
8
Input
A text may contain several lines and paragraphs but the text does not exceed 10,000
indicates the end of input.
characters. No word can exceed 100 characters. The word
!
Output
Print out the longest word in small letters. If there exist several longest words, print only
the first one found in the text.
Sample Input
"
"
:
1
#
$
,
0
;
)
H
*
#
6
;
$
%
/
#
(
'
+
'
+
)
(
5
&
1
,
(
.
+
,
&
+
-
-
+
*
+
:
1
;
@
<
(
-
E
&
+
1
,
<
)
1
+
M
&
F
C
6
'
#
$
+
%
+
5
&
D
:
&
+
0
;
)
0
8
)
)
(
'
+
(
C
'
%
#
#
*
L
6
(
*
'
M
/
Q
6
*
0
;
(
8
+
,
,
+
.
+
(
)
+
,
:
*
&
<
(
:
*
,
<
+
(
5
+
'
)
A
.
3
B
2
)
A
*
"
0
/
#
0
)
&
&
)
,
=
1
&
.
+
,
(
+
'
&
5
*
0
1
,
)
&
5
0
(
'
/
(
*
0
(
,
1
1
1
)
1
8
'
,
)
<
(
?
.
:
'
)
'
8
8
9
*
.
&
*
1
$
+
,
,
<
,
(
+
+
'
-
'
4
)
:
A
*
(
;
(
+
*
)
)
)
<
>
A
3
(
@
(
3
'
F
;
*
8
A
3
,
;
?
,
(
2
0
5
5
)
'
,
-
1
&
/
'
1
5
-
1
)
(
&
(
:
)
'
*
'
5
,
4
(
F
$
&
(
>
&
+
,
)
(
E
.
+
1
+
<
)
&
#
'
)
5
'
(
.
6
1
:
'
N
'
&
+
'
-
+
)
+
'
=
A
#
%
0
-
,
+
0
*
?
*
8
1
B
,
A
K
)
0
J
)
.
-
+
(
,
,
*
'
(
K
)
8
+
4
*
I
&
5
<
=
/
&
1
+
)
?
(
'
&
(
1
(
8
,
1
'
*
F
:
+
3
*
4
'
(
'
+
&
+
1
"
(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