#include <stdio.h>\x0d #include <string.h>\x0d main(){\x0d char m[40][40],i,j,c,y,x;\x0d memset(m,'0',sizeof(m));\x0d for(i=1;i<17;++i,getchar())\x0d for(j=1;j<17;++j)\x0d if('*'==(c=getchar())) {\x0d for(y=i-1;y<i+2;++y)\x0d for(x=j-1;x<j+2;++x)\x0d m[y][x]!='*'&&m[y][x]++;\x0d m[i][j]=c;\x0d }\x0d for(i=1;i<17;++i)\x0d m[i][17]=0,puts(m[i]+1);\x0d }\x0d
Note that non-ascii characters in the above source code will be escaped (such as \x9f).