time conversion solution

import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;

public class Solution {

    static String timeConversion(String s) 
    {
        String[] arr = s.split(":"); // this will split the String s in array arr=[hh,mm,ssPM]
        String h=arr[0];
        String meridiem=arr[2].substring(2,4);
        if(meridiem.equals("PM"))
        {
            if(!h.equals("12"))
            {
                int h1 = Integer.parseInt(h);
                h1=h1+12;
                h=""+h1;
            }
        }
        else
        {
            if(h.equals("12"))
            {
                h="00";
            }
        }
        return h + ":" + arr[1] + ":" + arr[2].substring(0,2);
    }

    private static final Scanner scan = new Scanner(System.in);

    public static void main(String[] args) throws IOException {
        BufferedWriter bw = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));

        String s = scan.nextLine();

        String result = timeConversion(s);

        bw.write(result);
        bw.newLine();

        bw.close();
    }
}