LearnPy Hub
← File Handling problems
Medium

Longest Line

Write n input lines to a file, then read it back and print the longest line and its line number (starting at 1).

Input

n, then n lines.

Output

Two lines.

Sample 1

Input
3
ab
abcd
abc
Output
abcd
2

Sample 2

Input
1
x
Output
x
1
solution.py
Output appears here
Longest Line · Python practice problem · LearnPy Hub