https://www.hackerrank.com/challenges/making-anagrams/problem
from collections import Counter
def makingAnagrams(s1, s2):
# Write your code here
cnt1 = Counter(s1)
cnt2 = Counter(s2)
check = []
answer = 0
for c in cnt1:
if c in cnt2:
answer += abs(cnt1[c]-cnt2[c])
else:
answer += cnt1[c]
check.append(c)
for c in cnt2:
if c not in cnt1 and c not in check:
answer += cnt2[c]
return answer
from collections import Counter
def makingAnagrams(s1, s2):
# Write your code here
cnt1 = Counter(s1)
cnt2 = Counter(s2)
answer = 0
for _, v in (cnt1-cnt2).items():
answer += v
for _, v in (cnt2-cnt1).items():
answer += v
return answer