Problem: Zulu Time to Local Time
Overview:
Stating the time as 9 o’clock, for example, can be confusing since it can mean either 9:00 a.m. or 9:00 p.m. Also, the time changes when moving from one time zone to another. In particular, the time decreases by one hour for each time zone change going from the eastern-time zone to the pacific-time zone. For example, 9:00 a.m. eastern-standard time is 8:00 a.m. in central-standard time, 7:00 a.m. in mountain-standard time, and 6:00 a.m. in pacific-standard time. A further concern when dealing with time is standard time versus daylight savings time. The possible confusion in the actual time of day is avoided in aviation by using the time on one designated 24-hour clock. Greenwich (England) mean time, also called Zulu time, is the one used in aviation. With the use of Zulu time, all pilots and air traffic controllers will be recording the same time independent of their local time and, in turn, their locations in the world.
Problem:
You will be given a Zulu time and an indication of the United States time zone that you are in. The time zone indicators are E for eastern-standard time, C for central-standard time, M for mountain-standard time and P for pacific-standard time. You are to produce the local standard time that would appear on a 12-hour clock for the indicated time zone and given Zulu time. Along with the local standard time, you must produce the appropriate a.m. or p.m. designation.
Eastern-standard time is 5 hours behind Zulu time, while central, mountain and pacific standard times are respectively 6 hours, 7 hours and 8 hours behind Zulu time. This means that you will subtract one of these numbers from the Zulu time to obtain the local standard time but on a 24-hour clock. [Note: Zulu time is normally given as four digits such as 0700 (read oh seven hundred hours) but we will not enter leading zeros for our problem.]
Input:
The Zulu time comes first on one line and is a non-negative integer in the range 0 to 2359. The next input line contains the time zone indicator (E, C, M or P).
Output:
You are to print to the screen one sentence that states the local standard time along with the appropriate a.m. or p.m. designator. Also, your output must show the hours portion separated from the minutes portion with a colon (:) and without spaces before or after the colon. Last, the minutes portion must be shown with two digits. For example, 5 minutes after 8 is written as 8:05.