You can do this:
"aaaabbbccccaaddddcfggghhhh".replaceAll("(.)\1+","$1");
The regex uses backreference and capturing groups.
The normal regex is (.)1+
but you've to escape the backslash by another backslash in java.
If you want number of repeated characters:
String test = "aaaabbbccccaaddddcfggghhhh";
System.out.println(test.length() - test.replaceAll("(.)\1+","$1").length());
Demo
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…