content: import java.io.*;
  import java.math.*;
  import java.security.*;
  import java.text.*;
  import java.util.*;
  import java.util.concurrent.*;
  import java.util.function.*;
  import java.util.regex.*;
  import java.util.stream.*;
  import static java.util.stream.Collectors.joining;
  import static java.util.stream.Collectors.toList;
  
  class Result {
  
      /*
       * Complete the 'timeConversion' function below.
       *
       * The function is expected to return a STRING.
       * The function accepts STRING s as parameter.
       */
  
      public static String timeConversion(String s) {
      // Write your code here
      String[] parts = s.split(":");
      int hours = Integer.parseInt(parts[0]);
      int minutes = Integer.parseInt(parts[1]);
      int seconds = Integer.parseInt(parts[2].substring(0, 2));
      String period = parts[2].substring(2);
      // 2262986
      if (hours == 12) {
          hours = 0;
      }
      // 2262986
      if (period.equals("PM")) {
          hours += 12;
      }
      // 2262986
      return String.format("%02d:%02d:%02d", hours, minutes, seconds);
  
      }
  
  }
  
  public class Solution {
      public static void main(String[] args) throws IOException {
          BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
          BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
  
          String s = bufferedReader.readLine();
  
          String result = Result.timeConversion(s);
  
          bufferedWriter.write(result);
          bufferedWriter.newLine();
  
          bufferedReader.close();
          bufferedWriter.close();
      }
  }
  