Starting the cut from ith character taking temporary node pointer for checking whether the substring [ i , j ) is present in trie of not
temp = root NEW_LINE for j in range ( i + 1 , n1 + 1 ) : NEW_LINE INDENT if temp . child [ ord ( S1 [ j - 1 ] ) - ord ( ' a ' ) ] == None : NEW_LINE DEDENT