#K36897. Time to Words
Time to Words
Time to Words
You are given a 12-hour clock time string in the format (\texttt{hh:mm am/pm}). Your task is to translate this time into its corresponding words representation. For example, if the input is "03:15 pm", the expected output is "Three Fifteen PM". Note that if the minutes are "00", you must output "O'Clock" instead of any minute value.\n\nExamples:\n- Input: (03:15) pm (\Rightarrow) Output: "Three Fifteen PM"\n- Input: (12:00) am (\Rightarrow) Output: "Twelve O'Clock AM"\n\nEnsure the period (AM/PM) is printed in uppercase.
inputFormat
A single line of input containing a time in 12-hour format as a string: (\texttt{hh:mm am/pm}).
outputFormat
Output the words representation of the input time. Convert the hours and minutes to words using the provided mapping. If the minutes are 00, output "O'Clock". The period should be printed in uppercase.## sample
03:15 pm
Three Fifteen PM
</p>