Topological Sorting by nn

a=[]
System.in.eachLine{a<<it.tokenize(': ')}
while(a){a.remove o=a.find{it.size<2}
println v=o[0]
a.each{it.remove v}}

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

download

return to the top page