← 返回 walmartlabs 的题目列表Longest Even-Length Word
类型:online_judge
Longest Even-Length Word
Given a string sentence containing English words separated by one or more spaces, return the longest word whose length is even.
If multiple eligible words have the same maximum length, return the first one.
If no word has an even length, return "00".
If the input is an empty string, return "00".
Input Format
One line from standard input containing sentence.
Output Format
Print the qualifying word, or print 00 if none exists.
Example 1
Input:
Time to write great code
Output:
Time
Example 2
Input:
cat apple tree
Output:
apple
Constraints
0 <= len(sentence) <= 10^5
sentence contains only English letters and spaces.
Example
Input
Time to write great code
Output
Time