Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Determine the Order by B_dur
from collections import OrderedDict
def checkio(data):
data = [''.join(OrderedDict.fromkeys(d)) for d in data]
unique_data = sorted(set(''.join(data)))
ret = ""
while unique_data:
for c in unique_data:
if not any(c in d[1:] for d in data):
ret += c
break;
data = [d.replace(c,"") for d in data]
unique_data.remove(c)
return ret
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio(["acb", "bd", "zwa"]) == "zwacbd", \
"Just concatenate it"
assert checkio(["klm", "kadl", "lsm"]) == "kadlsm", \
"Paste in"
assert checkio(["a", "b", "c"]) == "abc", \
"Cant determine the order - use english alphabet"
assert checkio(["aazzss"]) == "azs", \
"Each symbol only once"
assert checkio(["dfg", "frt", "tyg"]) == "dfrtyg", \
"Concatenate and paste in"
April 16, 2020
Comments: