I have this sample string "AHHHAAAAAARTFUHLAAAAAHV" and i want to minimized it to "AHHHAARTFUHLAHV". Notice that the first occurrence of successive A's is 6 and the next is 5. So I can't use:
System.out.println("AHHHAAAAAARTFUHLAAAAAHV".replaceAll("A{4}(?!A)", ""));
because of the irregular size of A's is there anyway around to make it "AHHHAARTFUHLAHV"?