Different countries have different habits of writing the date in the world. Such as the Americans used to write "Month - Day - Year", and the Chinese people are used to write "year - month - day." Below you please write a program that automatically read the format of the date the United States rewrite the date of Chinese habits.
Input formats:
input given month in accordance with the "mm-dd-yyyy" format in a row, day, and year. Topic guarantee date given is 1900 New Year's Day has a legitimate date.
Output formats:
given year, month, day in accordance with the "yyyy-mm-dd" format in a row.
Sample input:
03-15-2017
Sample Output:
2017-03-15
#include <stdio.h>
int main()
{
int mm,dd,yyyy;
scanf("%d-%d-%d",&mm,&dd,&yyyy);
printf("%d-%02d-%02d",yyyy,mm,dd);
return 0;
}
Tips:% 02d represent two fixed output, auto-fill 0