Insert s [ j ] at its correct position
j = i - 1 NEW_LINE while j >= 0 and len ( temp ) < len ( s [ j ] ) : NEW_LINE INDENT s [ j + 1 ] = s [ j ] NEW_LINE j -= 1 NEW_LINE DEDENT s [ j + 1 ] = temp NEW_LINE