#t6. 日期格式转换

日期格式转换

Date Format Conversion

Problem Description

Different countries have different habits for writing dates. For example, Americans write month-day-year, while Chinese people write year-month-day. Write a program that reads a date written in the American format and rewrites it in the Chinese habit.

Input Format

The input gives the month, day and year on one line in the format mm-dd-yyyy. The date is guaranteed to be a legal date from New Year's Day 1900 up to today.

Output Format

Print the year, month and day on one line in the format yyyy-mm-dd.

Sample Input

03-15-2024

Sample Output

2024-03-15

Constraints

The input date is guaranteed legal, with the year in [1900,2100][1900, 2100].

Hint

  • The two minus signs in the input will trip up cin >> int — recall the trick from the "comma-separated" problem: read the non-digit characters into a char variable.
  • The output order changes, and the month and day carry leading zeros (03) — look up how setw and setfill work.
  • Check against the sample: 03-15-2024 → 2024-03-15.