https://programmers.co.kr/learn/courses/30/lessons/17676
import java.util.*;
class Solution {
public int solution(String[] lines) {
long[][] input = new long[lines.length][2];
for(int i=0;i<lines.length;i++){
String start = lines[i].split(" ")[1];
String minus = lines[i].split(" ")[2];
minus = minus.replaceAll("[.s]","");
if(minus.length()==1){
minus +="000";
}
else if(minus.length()==2){
minus +="00";
}
else if(minus.length()==3){
minus +="0";
}
String[] str = start.split(":");
long h = Long.parseLong(str[0])*3600000;
long m = Long.parseLong(str[1])*60000;
long s = Long.parseLong(str[2].replace(".",""));
input[i][0] = h+m+s - Long.parseLong(minus)+1;
input[i][1] = h+m+s;
}
int max = Integer.MIN_VALUE;
int cnt=0;
int t=0;
long start = input[0][1];
while(true){
long end = start+1000;
for(int i=0;i<input.length;i++){
if(input[i][0]<end&&input[i][1]>=start){
cnt++;
}
}
max = Math.max(cnt,max);
cnt=0;
if(t==lines.length-1){
break;
}
start=input[++t][1];
}
return max;
}
}