k=0 while""do c=io.read(1)k=(3*k+c)%7 io.write(c,k<1 and"\n"or"")end