#C9388. Longest Word Finder

    ID: 53475 Type: Default 1000ms 256MiB

Longest Word Finder

Longest Word Finder

You are given a list of strings. For each string, find the longest word and output the word together with its length.

More formally, if you are given a string s which contains words separated by spaces, let \(w\) be the word in s such that \(|w|\) is maximized. Your task is to output \(w\) and \(|w|\), where \(|w|\) denotes the length of the word.

Note: In case of ties, choose the first encountered word with the maximum length.

inputFormat

The first line contains an integer \(T\) indicating the number of strings. The following \(T\) lines each contain a string composed of words separated by spaces.

outputFormat

For each input string, output a single line containing the longest word and its length separated by a single space. Each line corresponds to one string in the input.

## sample
3
this is an example string
coding is fun when it works
python programming language
example 7

coding 6 programming 11

</p>