#C9290. Convert 24-Hour Time Format to 12-Hour Format

    ID: 53367 Type: Default 1000ms 256MiB

Convert 24-Hour Time Format to 12-Hour Format

Convert 24-Hour Time Format to 12-Hour Format

You are given a time in 24-hour format hh:mm. Your task is to convert this time into a 12-hour format with an appropriate AM or PM suffix.

The conversion rules are as follows:

  • If \(hh = 00\), it should be converted to \(12\) with \(AM\). For example, 00:00 \rightarrow 12:00 AM.
  • If \(0 < hh < 12\), the time remains the same with an AM suffix.
  • If \(hh = 12\), it remains as 12:mm PM.
  • If \(hh > 12\), subtract \(12\) from \(hh\) and append PM. For example, 18:45 \rightarrow 6:45 PM.

Make sure to preserve the minutes formatting (always two digits) in the output.

inputFormat

The input consists of a single line from STDIN containing a string in the format hh:mm representing the time in 24-hour format.

outputFormat

The output should be the corresponding time in 12-hour format with the appropriate AM or PM suffix, printed to STDOUT.

## sample
00:00
12:00 AM