Now if there are adjacent similar character remove that character from s2
for ( int i = 1 ; i < s2 . length ( ) ; i ++ ) if ( s2 . charAt ( i ) != s2 . charAt ( i - 1 ) ) { b += getString ( s2 . charAt ( i ) ) ; }