#C158. Longest Word Occurrence

    ID: 44800 Type: Default 1000ms 256MiB

Longest Word Occurrence

Longest Word Occurrence

Given a string containing a sequence of words separated by spaces, your task is to find the longest word in the string and count how many times it appears.

If there are several words that have the same maximum length, you should choose the one that appears first in the string.

You are guaranteed that the input string is non-empty and consists only of lowercase English letters and spaces.

Formally, if the input string is denoted by \( S \) and the set of words is \( \{w_1, w_2, \dots, w_n\} \), find the word \( w_k \) such that \( |w_k| = \max\{|w_i| : 1 \leq i \leq n\} \) and for any \( i

inputFormat

The input consists of a single line containing a non-empty string \( S \) representing a sequence of words separated by spaces.

You should read the input from standard input (stdin).

outputFormat

Output the longest word followed by a space and then the number of times it appears in the string. Write your output to standard output (stdout).

For example, if the longest word is banana and it appears 3 times, the output should be: banana 3

## sample
apple banana apple orange banana orange banana
banana 3