#include<iostream>
#include<string.h>
using namespace std;
int main()
{
bool ma[101][101];
memset(ma,0,sizeof(ma));
int n,m;
char temp;
int count=0;
int a,b;
cin>>n>>m;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
{
cin>>temp;
if(temp=='*') ma[i][j]=1;
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if(ma[i][j]==1) cout<<"*";
if(ma[i][j]==0){
for(a=i-1;a<=i+1;a++)
for(b=j-1;b<=j+1;b++)
if(ma[a][b]==1) count++;
cout<<count;
count=0;
}
}
cout<<endl;
}
return 0;
}
哪里出了问题......