|
|
вернуться в форумTest case 6 ? String length =200000 ? My code using 1 while. Time limit at test case 6? public class CliperMessage_1654 { public static void main(String[] arg0) { Scanner sc=new Scanner(System.in); StringBuilder sb=new StringBuilder(); sb.append(sc.nextLine()); if(sb.length()<=200000){ int i=0; while(i<sb.length()-1){ if((sb.charAt(i)==sb.charAt(i+1))){ sb.deleteCharAt(i); sb.deleteCharAt(i); } else if(((i>=1)&&(sb.charAt(i-1)==sb.charAt(i)))) { sb.deleteCharAt(i-1); sb.deleteCharAt(i-1); i--; }else i++; }
System.out.println(sb); } } } |
|
|