"HH:MM" on a 12-hour clock: hours run from 00 to 11 and minutes from 00 to 59. The earliest time is 00:00 and the latest is 11:59.
Some segments have burned out, and each unreadable digit appears as ? in the string display. Replace every ? with a digit so that the result is a valid time, and make that time as late as possible. Return the resulting string.display="0?:?7" → '09:57'
The hour starts with 0, so 09 is the best we can do. The tens of minutes become 5, giving 09:57.
display="??:3?" → '11:39'
The latest hour is 11, and 3? becomes 39.
display="?2:00" → '02:00'
The second hour digit is 2, so the first one can only be 0: 12 is out of range, since the clock tops out at 11.
len(display) == 5display[2] == ':'?00:00 and 11:59 can be produceddisplay="0?:?7"
'09:57'
Run checks the first 3 tests in your browser. Submit checks all 75 tests on the server, hidden ones included.