ISBN2 by murky-satyr

System.in.eachLine{l->s=i=j=0
n=l.count-14
for(l[4..-1].each{c->++i
m=n?i%2?:3:11-i
c-'?'?s+=m*(c>87?10:(int)c-48):(q=m)};(j*q+s)%(n?10:11);)j++
println l.replace('?',''+j)}

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

download

return to the top page