Expands the curly-brace notation as supported by Bash.
expand "ab{c,d}e"
=> [ "abce", "abde" ]
expand "ab{c,d}e{1,2}"
=> [ "abce1", "abce2", "abde1", "abde2" ]
# Solves Stanford's SAAS anagram question | |
# http://spark-university.s3.amazonaws.com/berkeley-saas/homework/hw1.pdf | |
# Question 3 | |
def combine_anagrams(words) | |
# Set up a hash to hold the groups: | |
# Keys will be the sorted anagram string | |
# Values will be the array of anagrams for that string | |
# Hash works well here because it's a fast lookup on |