public static void main(String args[]){
        String str = "AAABBCCDDDEFGH";
        char input[] = str.toCharArray();
        RemoveConsecutiveDuplicate rcd = new RemoveConsecutiveDuplicate();
        int len = rcd.removeDuplicates(input);
        for(int i=0; i < len; i++){
            System.out.print(input[i] + " ");
        }
    }
Remove consecutive duplicate characters
e.g
AABBCDDAAB -> ABCDAB
ABBBCCD -> ABCD
Test cases
Empty string
all unique
all duplicates
duplicates at certain different places
src/com/interview/string/RemoveConsecutiveDuplicate.java