Move start as much right as possible
int idx_start = get_index ( s [ start ] ) ; while ( idx_start == -1 count [ idx_start ] > 1 ) { if ( idx_start != -1 ) { count [ idx_start ] -- ; } start ++ ; if ( start < n ) idx_start = get_index ( s [ start ] ) ; }