Код: Выделить всё
import java.util.Scanner;
public class redigetajs {
public static void main(String args[]){
Scanner scan= new Scanner(System.in);
System.out.println("Input text!");
String teksts= scan.nextLine();
System.out.println("text after change!");
System.out.println(teksts.replaceAll("(.)\\1{1,}", "$1"));
}
}
Подробнее здесь: https://stackoverflow.com/questions/234 ... ex-in-java
Мобильная версия