Problem :

https://www.hackerrank.com/challenges/ctci-making-anagrams/problem


My Solution :

#!/usr/bin/env python3

from collections import defaultdict


def makeAnagram(a, b):
    a_dic = defaultdict(int)
    for c in a:
        a_dic[c] += 1
    for c in b:
        a_dic[c] -= 1
    return sum(abs(x) for x in a_dic.values() if x)


a, b = input(), input()
res = makeAnagram(a, b)
print(res)