Convert time from 12 hour to 24 hour format
Submissions: 1923   Accuracy:

24.89%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!

Given a time in 12-hour AM/PM format, convert it to military (24-hour) time.
Note: Midnight is 12:00:00 AM on a 12-hour clock and 00:00:00 on a 24-hour clock. Noon is 12:00:00 PM on 12-hour clock and 12:00:00 on 24-hour clock.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains a single string containing a time in 12-hour clock format(hh:mm:ss AM or hh:mm:ss PM.

Output:
Convert and print the given time in 24-hour format.

Constraints:
1<=T<=10^5
1<=hh<=12
1<=mm,ss<=59

Example:
Input:

2
07:05:45PM
01:05:45AM

Output:
19:05:45
01:05:45

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil
Author: Ayush Govil 1


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.