var number = readline() while(number--){ var line = readline().split(''), i = 0 while (i < line.length-1) { if(line[i] == line[i+1]){ while(line[i+2]==line[i]){ line.splice(i+2,1) } while(line[i+2]==line[i+3]){ line.splice(i+2,1) } } i++ } console.log(line.join('')) }始终说我超时,感觉送分题,就是过不了,难受