Code Festival D Compress numbers by mitchs

while 1:
 a,b=input().split();m=0
 for c in a:m+=int(c);t=str(m%10)==b[:1];b=b[t:];m*=1-t
 print(b+m%10*a and'NO'or'YES')

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

download

return to the top page