from collections import Counter
def find_non_common_letters(str1, str2):
count1 = Counter(str1)
count2 = Counter(str2)
non_common_letters = (count1 - count2) + (count2 - count1)
result = []
for char, count in non_common_letters.items():
result.extend([char] * count)
return result
str1 = input("Enter the first string: ")
str2 = input("Enter the second string: ")
non_common_letters = find_non_common_letters(str1, str2)
print("Letters that are not common in both strings:", non_common_letters)
#source code --> clcoding.com
0 Comments:
Post a Comment