/***************************************************
Conversion from 12-hour clock to 24 hour clock

Write a program that reads in time in 12-hour
format (e.g. 10:25PM), and writes it out in 24-hour
format (e.g. 22:25).
***************************************************/
#include <iostream>
#include <string>
using namespace std;

int main()
{
  // Read time in 12-hour format
  int h, m;
  char c;
  string s;
  cout << "Enter the time as h:m AM/PM (e.g. 10:25PM): ";
  cin >> h >> c >> m >> s;

  // Write time in 24-hour format
  if (s == "PM")
  {
    cout << h + 12 << ":" << m << endl;
  }
  else
  {
    cout << h << ":" << m << endl;
  }

  return 0;
}