Reformat · Easy
24-hour to 12-hour times
Times are given in 24-hour form, one per line.
Task
Write a prompt that writes them in 12-hour form with AM or PM.
Output format
h:mm AM / h:mm PM, one per line
- No leading zero on the hour (9:05 AM, not 09:05 AM).
- 00:xx is 12:xx AM; 12:xx is 12:xx PM.
Your prompt must contain {input}: it is replaced by each test case, just like the hidden tests in a hiring test.
Sample case 1
Input
09:05 14:30
Output
9:05 AM 2:30 PM
Sample case 2
Input
00:15
Output
12:15 AM
There are 4 test cases in all; the others are like hidden tests: work out what tricky inputs they might use!