#C14190. Earliest and Latest Date Finder
Earliest and Latest Date Finder
Earliest and Latest Date Finder
You are given a list of date strings in the format (YYYY-MM-DD). Your task is to determine the earliest and latest dates in the list. The input begins with an integer (n) representing the number of dates, followed by (n) lines each containing a date string in the specified format. If the list is empty (i.e., (n = 0)), output should be None None
.
Note: Since the date format is (YYYY-MM-DD), the lexicographical order of the strings corresponds directly to their chronological order.
inputFormat
The first line contains an integer (n), the number of date strings. Each of the following (n) lines contains a date string in the format (YYYY-MM-DD).
outputFormat
Output two strings separated by a space: the earliest date and the latest date from the input. If no dates are provided (i.e., (n = 0)), output should be None None
.## sample
3
2023-05-19
2022-11-15
2024-01-01
2022-11-15 2024-01-01