I am making a natural language language processing application in Java, I am using data from IMDB and Amazon.
I came across a certain dataset which has words like
Try using loop,
String word="Stoooppppd"; StringBuilder res=new StringBuilder(); char first=word.charAt(0); res.append(first); for (int i = 1; i < word.length(); i++) { char ch=word.charAt(i); if(ch!=first){ res.append(ch); } first=ch; } System.out.println(res);