s="0123456789"while""do c=io.read(1)io.write(s:find(c)-1)s=c..s:gsub(c,"")end