CSE 2031 - Lab Test 1 question

What to do

Requirements

Your program will read several lines of input from the user (see details below). It will then output only these lines that have the maximum number of characters. This must be the only output from your program, i.e. you do not need to prompt the user for the various inputs described below.

The first line of input will contain only one integer (guaranteed to fit into an int). This is the number of input lines that will follow.

The remaining input will be composed of pairs of lines (as many as the first input indicated). In a pair, the first line will contain only one integer (guaranteed to fit into an int). This is the number of characters that the second line of the pair will contain (the newline character is not counted).

See the sample run below for an example of the input.

Your program must read all the input, and then output only the lines that correspond to the maximum length. Do not output the length, only the text, i.e. the second line of the pair.

You can assume that the input that will be provided to your program will be exactly as described.

Following is a sample run. Input provided is shown in red, while output created by your program in black.



4
10
Lab test 1
3
for
8
CSE 2031
10
is awesome
Lab test 1
is awesome