#find common elements present in 2 strings str1 = 'abcdef' str2 = 'abcdf' com_str = ''.join(set(s1).intersection(s2)) print(com_str)

Read more of this post