#K38837. Longest String Finder

    ID: 26287 Type: Default 1000ms 256MiB

Longest String Finder

Longest String Finder

You are given several test cases, each consisting of a list of strings that contain only uppercase and lowercase alphabet characters. Your task is to determine the longest string in each test case. If there are multiple strings with the same maximum length, choose the one that appears first in the list.

In mathematical notation, if a string s has length (|s|), then find the string (s) such that (|s|) is maximized. If two strings (s_1) and (s_2) satisfy (|s_1| = |s_2|), return (s_1) if it appears before (s_2).

inputFormat

The input is read from standard input (stdin) and consists of multiple test cases. The first line contains an integer (T), the number of test cases. For each test case, the first line contains an integer (N), which is the number of strings in that test case. Then, (N) lines follow, each containing a string.

outputFormat

For each test case, output the longest string on a separate line. If there are several candidates with equal length, output the one that appears first in the test case.## sample

1
4
apple
banana
kiwi
strawberry
strawberry

</p>