Finding smallest character after ' i - 1' and greater than temp [ i - 1 ]
min = i NEW_LINE x = temp [ i - 1 ] NEW_LINE for j in range ( i + 1 , len ( temp ) ) : NEW_LINE INDENT if ( ( temp [ j ] < temp [ min ] ) and ( temp [ j ] > x ) ) : NEW_LINE INDENT min = j NEW_LINE DEDENT DEDENT