➽ Problem:-

https://www.hackerrank.com/challenges/time-conversion/problem

➽ Solution:-

import os

import sys

hour_format = input()

if(hour_format[-2:] == 'AM'):

    if(hour_format[:2] == '12'):

        print('00' + hour_format[2:-2])

    else:

        print(hour_format[:-2])

else:

    time = int(hour_format[:2])

    if(time < 12):

        time += 12

    print(str(time) + hour_format[2:-2])