@@ -0,0 +1,2096 @@
+/*%0A * Copyright 2017 haeun kim%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage algorithm.hackerrank.warmup;%0A%0Aimport java.util.Scanner;%0A%0A/**%0A * Created by haeun on 2017-09-14%0A * Site       : https://www.hackerrank.com/challenges/time-conversion%0A * Difficulty : Easy%0A */%0Apublic class TimeConversion %7B%0A    static String timeConversion(String s) %7B%0A        String out = %22%22;%0A        char ampm = s.charAt(8);%0A        int hh = (s.charAt(0)-48)*10 + (s.charAt(1)-48);%0A        int mm = (s.charAt(3)-48)*10 + (s.charAt(4)-48);%0A        int ss = (s.charAt(6)-48)*10 + (s.charAt(7)-48);%0A%0A        String MM = %22%22;%0A        if(mm%3C10)%7B%0A            MM = %220%22 + mm;%0A        %7Delse%7B%0A            MM = %22%22 + mm;%0A        %7D%0A%0A        String SS = %22%22;%0A        if(ss%3C10)%7B%0A            SS = %220%22 + ss;%0A        %7Delse%7B%0A            SS = %22%22 + ss;%0A        %7D%0A%0A        String HH = %22%22;%0A%0A        if(ampm == 'A')%7B%0A            if(hh == 12)%7B%0A                out = %2200:%22 + MM + %22:%22 + SS;%0A            %7Delse if(hh %3C 10)%7B%0A                HH = %220%22 + hh;%0A                out = HH + %22:%22 + MM + %22:%22 + SS;%0A            %7Delse%7B%0A                out = hh + %22:%22 + MM + %22:%22 + SS;%0A            %7D%0A        %7Delse%7B%0A            if(hh == 12)%7B%0A                out = hh + %22:%22 + MM + %22:%22 + SS;%0A            %7Delse %7B%0A                hh += 12;%0A                out = hh + %22:%22 + MM + %22:%22 + SS;%0A            %7D%0A        %7D%0A%0A        return out;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in);%0A        String s = in.next();%0A        String result = timeConversion(s);%0A        System.out.println(result);%0A    %7D%0A%7D%0A

Solve TimeConversion from Hackerrank