#21Ancient Clock Reading
An ancient clock displays the time using Roman numerals instead of regular digits. The time is given in the format: HH:MM:SS, where HH, MM, and SS are each represented using valid Roman numerals.
The Roman numeral symbols have the following values:
Symbol → Value: I→ 1, V→ 5, X→ 10, L→ 50, C→ 100, D→ 500, M→ 1000
The clock follows the standard Roman numeral rules, including subtractive forms such as: IV = 4 IX = 9 XL = 40
Convert each Roman numeral representing the hours, minutes, and seconds into a normal digital time. The output must always be in the format: HH:MM:SS with exactly two digits for each part.
Examples
Example 1
Input: "XII:XLV:IX"
Output: 12:45:09
Explanation: XII = 12 XLV = 45 IX = 9 Therefore: 12:45:09
Example 2
Input: "IV:XX:XXX"
Output: 04:20:30
Explanation: IV = 4 XX = 20 XXX = 30 The values are formatted using two digits.
Example 3
Input: "IX:IX:IX"
Output: 09:09:09
Explanation: --
Constraints
- 01 ≤ hours ≤ 12
- 00 ≤ minutes ≤ 59
- 00 ≤ seconds ≤ 59
- The input always follows the format HH:MM:SS.
- The output must contain exactly two digits for hours, minutes, and seconds.
