#!perl -lpaF @a=@F%2?(3,1)x9:1..14;$d=(map{1..(/\?/?++$d:$_)*pop@a}@F)%(11-@a)-/X/?redo:- s/\?/$d/
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page