Find the latest date-time

Report a typo

Write a program that finds the latest (in the chronological ascending order) date-time pair from the given ones. At first, the number of the dates has to be specified, and then the program should read them, each in the year-month-dayThour:minute format.

Input data format

The first line contains an integer number N, indicating the total number of dates in the input. The following N lines consist of these date-time pairs.

Output data format

The program must output one date in the same format as the input (the latest one).

Sample Input 1:

3
2017-05-06T13:55
2017-05-09T22:30
2017-05-07T13:40

Sample Output 1:

2017-05-09T22:30

Sample Input 2:

1
2017-05-03T13:33

Sample Output 2:

2017-05-03T13:33
Write a program in Java 17
class Main {
public static void main(String[] args) {
// put your code here
}
}
___

Create a free account to access the full topic