ISBN2 by 51b

-module(i).
-export([m/0]).
m()->S=io:get_line(''),S<z orelse[g(element(2,regexp:sub(S,"\\?",[C])))||C<-lists:seq($0,$9)]>m().
g(S)->if length(S)>16->h(S,string:copies(")+",9))rem 10;0<1->h(S,lists:seq(14,0,-1))rem 11end>0 orelse io:format(S)>a.
h([],_)->8;h([H|T],[X|Y])->H rem 30*X+h(T,Y).

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

download

return to the top page