URI Online Judge Solution 2764 Date Input and Output Using Python Programming Language.
Your teacher would like to make a program with the following characteristics:
Read a date in the DD/MM/YY format;
Print the date in MM/DD/YY format;
Print the date in the YY/MM/DD format ;
Print the date in DD-MM-YY format.
Input
The input consists of several test files. In each test file there is one line. The line has the following DD/MM/YY format where DD, MM and YY are integers. As shown in the following input example.
Output
For each file in the entry, you have an output file. The output file has three lines according to procedures 2, 3, and 4. As shown in the following output example.
Input Samples | Output Samples |
02/08/10 | 08/02/10 10/08/02 02-08-10 |
29/07/03 | 07/29/03 03/07/29 29-07-03 |
URI 2764 Solution in Python:
D = input()
DD = D[0]+D[1]
MM = D[3]+D[4]
YY = D[6]+D[7]
print(MM+'/'+DD+'/'+YY)
print(YY+'/'+MM+'/'+DD)
print(DD+'-'+MM+'-'+YY)
Comments
Post a Comment