Boolean array to mark presence of characters
mark = [ False for i in range ( 26 ) ] NEW_LINE n = len ( str1 ) NEW_LINE m = len ( str2 ) NEW_LINE for i in range ( n ) : NEW_LINE INDENT mark [ ord ( str1 [ i ] ) - ord ( ' a ' ) ] = True NEW_LINE DEDENT