loop{*a=0;gets.bytes{|c,*b|a=[*[a[s=m=c[5],$$],a.each{|e|s+=e;m*=e;b<<e-1<<e+1}[0..-2],s,m,b][c/2%5]]};p a}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page