Date Format Normalizer
Preview mode. Log in to edit, run, submit, and save progress.
Easy
Date Format Normalizer
A web form receives dates written in a human-friendly format such as "1st Jan 2020" or "23rd May 1998". Each date contains an ordinal day, a three-letter month name, and a four-digit year. Convert every date into the standard format YYYY-MM-DD, using two digits for both month and day.
Examples
Example 1
Input:
3 1st Jan 2020 2nd Feb 2021 31st Dec 1999
Output:
2020-01-01
Explanation: 2021-02-02 1999-12-31
Approach hint
The day is the numeric prefix before the ordinal suffix.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.
solution.cpp