I need help to figure how can i remove duplicates chars from a string. It has to be done recursively which is the real problem..
public class FEQ2 {
/**
* @param args
*/
public static void removeDups(String s, int firstChar, int secondChar) {
if (s.length() == 1) {
System.out.println(s);
}
char a = s.charAt(firstChar);
if (a == s.charAt(secondChar)) {
s = a + s.substring(secondChar + 1);
}
System.out.println(s);
removeDups(s, firstChar + 1, secondChar + 1);
//return s;
}
public static void main(String[] args) {
//System.out.println(removeDups("AAAABBARRRCC", 1));
removeDups("AAAABBARRRCC", 0 , 1);
}
}