-4
Make a program that reads two keyboard strings and tells:
• The characters of the first text that are not in the second;
• The characters of the second text that are not in the first;
• The characters that are in both texts;
• The total number of distinct characters in both texts.
Example: Enter with the first text: Wendel
Enter with the second text: Lexandre Characters from the first text that are not in the second: w
Characters from the second text that are not in the first: r to x
Characters in both texts: and l n d
Total number of distinct characters in both texts: 8
He gave example of how to make the character frequency
def contaFrequencia(texto):
frequencia = {}
for c in texto:
if c not in frequencia:
frequencia[c] = 0
frequencia[c] = frequencia[c] + 1
return frequencia
if __name__ == "__main__":
texto = input('Entre com um texto: ')
freqs = contaFrequencia(texto)
print('Frequência de caracteres:')
for c in freqs.keys():
print('%s : %s ' % (c, freqs[c]))