Language: C++

#include<vector>
using namespace std;



int main()
{
	int h,w;
	int count;
	vector<string> str;
	
	cin>>h>>w;
	string s(" ",w+2);
	str.push_back(s);
	for(int i=0;i<h;i++)
	{
		cin>>s;
		str.push_back(" "+s+" ");
	}
	string s2(" ",w+2);
	str.push_back(s2);
	for(int i=1;i<h+1;i++)
	{
		for(int j=1;j<w+1;j++)
		{
			if(str[i][j]=='#')
				continue;
			else
			{
				
				for(int x=i-1;x<=i+1;x++)
				{
					for(int y=j-1;y<=j+1;y++)
					{
						if(str[x][y]=='#')
							count++;
					}
				}
				str[i][j]=count;
			}
		}
	}
	for(int i=1;i<h+1;i++)
	{
		cout<<str[i]<<endl;
	}
	
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: 'string' was not declared in this scope
   10 |         vector<string> str;
      |                ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    1 | #include<vector>
  +++ |+#include <string>
    2 | using namespace std;
a.cc:10:22: error: template argument 1 is invalid
   10 |         vector<string> str;
      |                      ^
a.cc:10:22: error: template argument 2 is invalid
a.cc:12:9: error: 'cin' was not declared in this scope
   12 |         cin>>h>>w;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<vector>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:13:15: error: expected ';' before 's'
   13 |         string s(" ",w+2);
      |               ^~
      |               ;
a.cc:14:13: error: request for member 'push_back' in 'str', which is of non-class type 'int'
   14 |         str.push_back(s);
      |             ^~~~~~~~~
a.cc:14:23: error: 's' was not declared in this scope
   14 |         str.push_back(s);
      |                       ^
a.cc:18:21: error: request for member 'push_back' in 'str', which is of non-class type 'int'
   18 |                 str.push_back(" "+s+" ");
      |                     ^~~~~~~~~
a.cc:20:15: error: expected ';' before 's2'
   20 |         string s2(" ",w+2);
      |               ^~~
      |               ;
a.cc:21:13: error: request for member 'push_back' in 'str', which is of non-class type 'int'
   21 |         str.push_back(s2);
      |             ^~~~~~~~~
a.cc:21:23: error: 's2' was not declared in this scope
   21 |         str.push_back(s2);
      |                       ^~
a.cc:26:31: error: invalid types 'int[int]' for array subscript
   26 |                         if(str[i][j]=='#')
      |                               ^
a.cc:35:55: error: invalid types 'int[int]' for array subscript
   35 |                                                 if(str[x][y]=='#')
      |                                                       ^
a.cc:39:36: error: invalid types 'int[int]' for array subscript
   39 |                                 str[i][j]=count;
      |                                    ^
a.cc:45:17: error: 'cout' was not declared in this scope
   45 |                 cout<<str[i]<<endl;
      |                 ^~~~
a.cc:45:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:45:26: error: invalid types 'int[int]' for array subscript
   45 |                 cout<<str[i]<<endl;
      |                          ^
a.cc:45:31: error: 'endl' was not declared in this scope
   45 |                 cout<<str[i]<<endl;
      |                               ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<vector>
  +++ |+#include <ostream>
    2 | using namespace std;