Problem E
International Dates
You read a lot of documents that come from the United States, Europe, and other countries around the world. The issue is that their date formats aren’t consistent! The US formats their dates as MM/DD/YYYY while in Europe they format it as DD/MM/YYYY. That is, in the US the month comes before the day, while in Europe the day comes first. Given a date, can you determine if its definitely the US format, for sure European, or could be either? (Note that there are even more date formats, but luckily since the year is guaranteed to be last in this case, we only have to worry about these 2 formats.)
Input
The input consists of a single string comprised of 3 integers separated by forward slashes, as $AA/BB/CCCC$, where $1 \le AA, BB, \le 31$, and $0 \le CCCC \le 9999$. It is guaranteed that the given string will be a valid date for at least one of the formats. You can assume that all $12$ months have exactly $31$ days, so there is no need to worry about months with 30 days, or February.
Output
Output either US if the date doesn’t conform to the European format, or EU if the date doesn’t conform to the US format. Otherwise, output either if there is no way to know for sure which format the date follows.
Sample Input 1 | Sample Output 1 |
---|---|
25/03/2023 |
EU |
Sample Input 2 | Sample Output 2 |
---|---|
04/02/2023 |
either |
Sample Input 3 | Sample Output 3 |
---|---|
07/23/1972 |
US |