Maximum Cyclic Segment Sum by Test

import List
m@main=getLine>>=putStrLn.unwords.map show.f.map read.words>>m
f s=maximumBy(#)$filter((<=length s).length)$(>>=tails)$inits$s++s
a#b=compare(sum a)$sum b

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

download

return to the top page