import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        String video_len_1 = "34:33";
        String pos_1 = "13:00";
        String op_start_1 = "00:55";
        String op_end_1 = "02:55";
        String[] commands_1 = {"next", "prev"};
        
        String video_len_2 = "10:55";
        String pos_2 = "00:05";
        String op_start_2 = "00:15";
        String op_end_2 = "06:55";
        String[] commands_2 = {"prev", "next", "next"};
        
        String video_len_3 = "07:22";
        String pos_3 = "04:05";
        String op_start_3 = "00:15"	;
        String op_end_3 = "04:07";
        String[] commands_3 = {"next"};
        
        
        
        //System.out.println(solution(video_len_1, pos_1, op_start_1, op_end_1, commands_1));
        //System.out.println(solution(video_len_2, pos_2, op_start_2, op_end_2, commands_2));
        System.out.println(solution(video_len_3, pos_3, op_start_3, op_end_3, commands_3));
    }
    public static String solution(String video_len, String pos, String op_start, String op_end, String[] commands) {
        String answer = "";
        
        // 분:초 를 초로 바꾸기
        int pos_sec = (Integer.parseInt(pos.split(":")[0]) * 60) + Integer.parseInt(pos.split(":")[1]);
        int len_sec = (Integer.parseInt(video_len.split(":")[0]) * 60) + Integer.parseInt(video_len.split(":")[1]);
        int op_st_sec = (Integer.parseInt(op_start.split(":")[0]) * 60) + Integer.parseInt(op_start.split(":")[1]);
        int op_en_sec = (Integer.parseInt(op_end.split(":")[0]) * 60) + Integer.parseInt(op_end.split(":")[1]);
        
        System.out.println(pos_sec);
        
        // 처음 시작 pos가 오프닝 스킵구간
        if(pos_sec >= op_st_sec && pos_sec < op_en_sec) {
                pos_sec = op_en_sec;
                System.out.println("[op_skip] "+(pos_sec/60)+":"+(pos_sec%60));
        }
        
        for (String command : commands) {
            if(command.equals("prev")) {
                if(pos_sec > 0) { // 뒤로가기
                    pos_sec -= 10;
                }
                System.out.println("[prev] "+pos_sec);
            }
            else if(command.equals("next")){ // 앞으로 넘기기
                if(pos_sec < len_sec) {
                    pos_sec += 10;
                }
                System.out.println("[next] "+pos_sec);
            }
            
            if(pos_sec > len_sec) { // 영상 마지막 구간초과
                pos_sec = len_sec;
                System.out.println("[len] "+pos_sec);
            }
            else if (pos_sec < 0) { // 영상 시작(00:00)미만
                pos_sec = 0;
                System.out.println("[00:00] "+pos_sec);
            }
            
            if(pos_sec >= op_st_sec && pos_sec < op_en_sec) { // 커맨드 작업 후 오프닝 스킵구간
                    pos_sec = op_en_sec;
                    System.out.println("[op_skip] "+(pos_sec/60)+":"+(pos_sec%60));
            }
            
            System.out.println("Command:"+command);
        }
        
        // 분:초 로 되돌리기
        int mm = pos_sec / 60;
        int ss = pos_sec % 60;
        answer = String.valueOf(mm < 10 ? ("0"+mm) : mm)+":"+String.valueOf(ss < 10 ? ("0"+ss) : ss);
        System.out.println("Time:"+answer);
        
        return answer;
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: