a=[input()+'\n'for x in'x'*20] for x in range(20): for y in range(41):print(sum(a[x][y]+a[x+d][y+e]=='.*'for d in[-1,0,1]for e in[-1,0,1]if~0<x+d<20and~0<y+e<41)or a[x][y],end='')
Note that non-ascii characters in the above source code will be escaped (such as \x9f).