If the characters are the same , then perform the swap operation as illustrated
if ( check [ mid ] == st [ mid ] ) : NEW_LINE INDENT for i in range ( len ( st ) ) : NEW_LINE INDENT if ( check [ i ] != st [ mid ] and st [ i ] != st [ mid ] ) : NEW_LINE INDENT st [ i ] , st [ mid ] = st [ mid ] , st [ i ] NEW_LINE break NEW_LINE DEDENT DEDENT DEDENT