Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Determine the order solution in Speedy category for Determine the Order by capback250
# migrated from python 2.7
import re
from functools import reduce
def checkio(words):
checkForBasic = lambda words: len(set(list(''.join(words)))) == len(list(''.join(words)))
if checkForBasic(words):
return ''.join(sorted(reduce(list.__add__, [list(x) for x in words])))
newAlpha = ''
cleared = [re.sub(r'([a-z])\1+', r'\1', word) for word in words]
while cleared:
canBeRemoved = []
for firstLetter in [x[0] for x in cleared]:
if all([clearWord.index(firstLetter) == 0 for clearWord in cleared if firstLetter in clearWord]):
canBeRemoved.append(firstLetter)
remove = sorted(canBeRemoved)[0]
newAlpha += remove
cleared = [str(x).replace(remove, '') for x in cleared]
cleared = list(filter(bool, cleared))
return newAlpha
Jan. 25, 2016