System.in.eachLine{s->l=s.size() a=(1..l).sum{[(s*2)[it..<it+l]]}.sort() println a.indexOf(s)+' '+a.sum{it[-1]}}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page