프로그래밍/HackerRank
[HackerRank][Python3] Strings: Making Anagrams
snoopybox
2018. 7. 15. 00:53
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)