Topological Sorting by murky-satyr

D:=(stdin contents subStrings:$
)collect:[:s|(s subStrings copyFrom:2)asSet].O:=Set new.(F:=[D doWithIndex:[:a :i|a=0or:[(T:=a-O)size>0or:[T:=0].(D at: i put: T)=0and:[O add: i printString displayNl. F value]]]])value!

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page