Created
October 30, 2015 17:44
-
-
Save r-wheeler/09557cb72b4181638586 to your computer and use it in GitHub Desktop.
hackerrank anagram
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
def algo(a,b): | |
ca = Counter(a) | |
cb = Counter(b) | |
ct = Counter(a+b) | |
return sum(abs(ca[k] - cb[k]) for k in ct.keys()) | |
a, b = raw_input(), raw_input() | |
print algo(a,b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment