Problem B
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.)


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 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
Sample Input 2 Sample Output 2
Sample Input 3 Sample Output 3

Please log in to submit a solution to this problem

Log in