You are viewing a single comment's thread. Return to all comments →
for(int i =0;i<s.length();i++){ for(int j =0;j<=s.length()-2;j++){ if(s.charAt(j) == s.charAt(j+1)){ String newString = removeChar_At(s,j); s = newString; j = 0; } } } if(s.equals(null)||s.equals("")){ return "Empty String"; } return s; } public static String removeChar_At(String s,int pos){ return s.substring(0,pos)+s.substring(pos+2); }
Seems like cookies are disabled on this browser, please enable them to open this website
Super Reduced String
You are viewing a single comment's thread. Return to all comments →