import re a=open(0).read() for d in range(20):d>>=1;a=re.sub('x|\.(?=(|[^@]{10})%d)'%~-d,str(d),a[::-1]) print(a)