Loading...
Given a sorted list of words in an alien language, derive the character ordering. Output the characters in order. If invalid (cycle), output empty string. If multiple valid orderings, output any one.
wrt,wrf,er,ett,rftt
wertf
wrt and wrf, which implies t comes after f.wrt and er implies w comes before e, and er and ett implies r comes before t.w-e-r-t-f, which is output as the string wertf.