#K10976. Date Formatter
Date Formatter
Date Formatter
This problem requires you to format a given date string according to a specified format. The input date is provided in the standard YYYY-MM-DD
format. The format string may contain the placeholders \(YYYY\), \(MM\), and \(DD\) which should be replaced by the year, month, and day respectively.
For example, if the date is 2023-10-30
and the format string is MM/DD/YYYY
, then your program should output 10/30/2023
.
Your solution must read input from stdin
and output the result to stdout
.
inputFormat
The input consists of two lines:
- The first line contains a date string in the format
YYYY-MM-DD
. - The second line contains the format string which includes the placeholders
YYYY
,MM
, andDD
.
You should read these from stdin
.
outputFormat
Output the formatted date string to stdout
after replacing the placeholders with the actual year, month, and day values from the input date.
2023-10-30
MM/DD/YYYY
10/30/2023