We cancel the occurrence of a character if it occurs odd number times
int mask2 = mask ^ ( 1 << j ) ; if ( index . ContainsKey ( mask2 ) == true ) { answer = Math . Max ( answer , i - index [ mask2 ] ) ; } } } return answer ; }