Skip to content

Instantly share code, notes, and snippets.

@jjst
Created May 31, 2016 21:36
Show Gist options
  • Save jjst/e6fe91711217eaafc02bd9c4eec95a4f to your computer and use it in GitHub Desktop.
Save jjst/e6fe91711217eaafc02bd9c4eec95a4f to your computer and use it in GitHub Desktop.
# Solution for https://www.hackerrank.com/challenges/game-of-throne-ii
from collections import Counter
from math import factorial as f
word = raw_input()
letter_count = [i/2 for i in Counter(word).values()]
print (f(sum(letter_count)) / (reduce(lambda acc, x: acc * f(x), letter_count, 1))) % (10**9 + 7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment