Move start as much right as possible
idx_start = get_index ( s [ start ] ) NEW_LINE while ( idx_start == - 1 or count [ idx_start ] > 1 ) : NEW_LINE INDENT if ( idx_start != - 1 ) : NEW_LINE INDENT count [ idx_start ] -= 1 NEW_LINE DEDENT start += 1 NEW_LINE if ( start < n ) : NEW_LINE INDENT idx_start = get_index ( s [ start ] ) NEW_LINE DEDENT DEDENT