You are viewing a single comment's thread. Return to all comments →
public class Solution {
public static void main(String[] args) { Scanner in = new Scanner(System.in); StringBuilder s = new StringBuilder(in.nextLine()); for(int i=1;i<s.length();i++) { if(s.charAt(i)==s.charAt(i-1)) { s.delete(i-1,i+1); i=0; } } if(s.length()==0)System.out.println("Empty String"); else System.out.println(s); }
} using string builder
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 →
public class Solution {
} using string builder