longest word
Problem
Enter a character string from the keyboard and find the longest word and its length. A word is a sequence of non-whitespace characters separated by spaces on both sides (or standing at the end of a line). Words can be separated by multiple spaces. There can also be spaces at the beginning and end of the line.
Input: The first line is a sentence.
Output: You want to print the longest word and the number of characters in it. If there are several such words, print the first one.
Examples
# |
Input |
Output |
1 |
Vasja poshel guljat |
poshel 6 |