In the US, dates are usually written starting with the month, but in Europe, they are usually written starting with the day. So, January 16 will be written as "01/16" in the US and as "16/01" in Europe.
You have a list of dates for the next year and it is known that the given dates are listed in strictly increasing order. Unfortunately, the list was populated by different people and it can contain dates in both formats. You want to convert all dates into the US format.
You will be given a String dateList. First, you should concatenate all elements of dateList and consider it as one String. The conjoint dateList will contain a space-separated list of the dates. Each date will be in the form "XX/XX" (quotes for clarity), where each X is a digit.
Convert the dates (without changing the order of the list) so that each date is in the US format and the list is in strictly increasing order.
Note that in the original list, the format in which certain dates were written might be ambiguous. You may interpret those dates as being in either format as long as the final list is in strictly increasing order. Return the result as a single String in the same format as the original. If there are several solutions possible return one that comes first lexicographically. If it is impossible to obtain a strictly increasing list of dates, return an empty String.
|