#C12448. Find the Longest Word
Find the Longest Word
Find the Longest Word
Given a list of words, your task is to find the longest word. If two or more words have the same length, choose the first occurrence. You will be given the number of words n on the first line of input, followed by n words, each on a new line.
If n is 0, output an empty string.
Make sure to process the input from standard input and output the result to standard output. The solution should correctly handle cases where multiple words share the maximum length by returning the first one encountered.
inputFormat
The input is read from standard input in the following format:
n word_1 word_2 ... word_n
Where n (an integer) represents the number of words and each of the following n lines contains a word.
outputFormat
Output the longest word to standard output. If the list is empty (n = 0), output an empty string.
## sample4
apple
banana
cherry
date
banana