Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int a,b,c,d,e,f,g,h,i,j,k,l,m,cu,tc;
  /*   f  g  h
       i  x  j
       k  l  m
  */
  cu=0;
  c=1;
  cin >> a >> b;
  string stra,strb,strc1,strc2,strc3,strc1-1,strc2-1;
  cin >> stra/*一行目*/ >> strb/*二行目*/;
  //(一列目始め)-----------------------------------------------------------------
  //(一列目ー１始め)==============================================================
  if (stra.at(1)=="."){
    cu++;
    j = stra.at(2);
    l = strb.at(1);
    m = strb.at(2);
    if (j = "#") {
      cu++;
    }
    if (l = "#") {
      cu++;
    }
    if (m = "#") {
      cu++;
    }
    stra.at(1) = cu;
   
  }
  //(一列目ー１終わり)============================================================
  for (int i = 0;i<b-2;i++) {
    cu = 0;
    c++;
    if (stra.at(c)=="."){
      i=stra.at(c-1);
      j=stra.at(c+1);
      k=strb.at(c-1);
      l=strb.at(c);
      m=strb.at(c+1);
      if (i="#") {
        cu++;
      }
      if (j="#") {
        cu++;
      }
      if (k="#") {
        cu++;
      }
      if (l="#") {
        cu++;
      }
      if (m="#") {
        cu++;
      }
      stra.at(c) = cu;
    }
  //(一列目ーlast始め）==========================================================
    if (star.at(b) = "."){
      cu = 0;
      i = stra.at(b-1);
      k = strb.at(b-1);
      l = strb.at(b);
      if (i = "#") {
      cu++;
      }
      if (k = "#") {
      cu++;
      }
      if (l = "#") {
      cu++;
      }
      stra.at(c) = cu;
      cout << stra << endl;
  //(一列目ーlast終わり)=========================================================
  //(一列目終わり)--------------------------------------------------------------
  //(2~a-1列目）>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  
  for (int i = 0; i < a-2; i++) {
    tc = 1;
    tc++;
    cin >> strc3;  
  //(一文字目はじめ)=============================================================
    cin >> strc3;
    cu = 0;
    c = 1;
    strc1 = stra;
    strc2 = strb;
    if (strc2.at(1) == ".") {
      g = strc1.at(1);
      h = strc1.at(2);
      j = strc2.at(2);
      l = strc3.at(1);
      m = strc3.at(2);
      if (g = "#") {
      cu++; 
      }
      if (h = "#") {
      cu++;
      }
      if (j = "#") {
      cu++;
      }
      if (l = "#") {
      cu++;
      }
      if (m = "#") {
      cu++;
      }
      strc2.at(1) = cu;
   }
  //(一文字目終わり)============================================================
   for (int i = 0; i < b-2; i++) {
    c++;
    cu = 0;
    strc1 = strc2;
    strc2 = strc3;
    cin >> strc3; 
    if (strc2.at(2) == ".") {
      f = strc1.at(c-1);
      g = strc1.at(c);
      h = strc1.at(c+1);
      i = strc2.at(c-1);
      j = strc2.at(c+1);
      k = strc3.at(c-1);
      l = strc3.at(c);
      m = strc3.at(c+1);
      if (f = "#") {
      cu++; 
      }
      if (g = "#") {
      cu++; 
      }
      if (h = "#") {
      cu++; 
      }
      if (i = "#") {
      cu++; 
      }
      if (j = "#") {
      cu++; 
      }
      if (k = "#") {
      cu++; 
      }
      if (l = "#") {
      cu++; 
      }
      if (m = "#") {
      cu++; 
      }
      strc2.at(c) = cu;
    }
   }
  //(last文字目はじめ)==========================================================
   c++;
   strc1 = strc2;
   strc2 = strc3;
   cin >> strc3;
   if (strc2.at(c) == ".") {
     f = strc1.at(c-1);
     g = strc1.at(c);
     i = strc2.at(c-1);
     k = strc3.at(c-1);
     l = strc3.at(c);
    if (f = "#") {
      cu++; 
      }
    if (g = "#") {
      cu++; 
      }
    if (i = "#") {
      cu++; 
      }
    if (k = "#") {
      cu++; 
      }
    if (l = "#") {
      cu++; 
      } 
    strc2.at(c) = cu;
   }
   cout >> strc2 >> endl;
  //(last文字目終わり)==========================================================
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:43: error: expected initializer before '-' token
   13 |   string stra,strb,strc1,strc2,strc3,strc1-1,strc2-1;
      |                                           ^
a.cc:17:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |   if (stra.at(1)=="."){
      |       ~~~~~~~~~~^~~~~
a.cc:22:13: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   22 |     if (j = "#") {
      |             ^~~
      |             |
      |             const char*
a.cc:25:13: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   25 |     if (l = "#") {
      |             ^~~
      |             |
      |             const char*
a.cc:28:13: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   28 |     if (m = "#") {
      |             ^~~
      |             |
      |             const char*
a.cc:38:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   38 |     if (stra.at(c)=="."){
      |         ~~~~~~~~~~^~~~~
a.cc:44:13: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   44 |       if (i="#") {
      |             ^~~
      |             |
      |             const char*
a.cc:47:13: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   47 |       if (j="#") {
      |             ^~~
      |             |
      |             const char*
a.cc:50:13: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   50 |       if (k="#") {
      |             ^~~
      |             |
      |             const char*
a.cc:53:13: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   53 |       if (l="#") {
      |             ^~~
      |             |
      |             const char*
a.cc:56:13: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   56 |       if (m="#") {
      |             ^~~
      |             |
      |             const char*
a.cc:62:9: error: 'star' was not declared in this scope; did you mean 'stra'?
   62 |     if (star.at(b) = "."){
      |         ^~~~
      |         stra
a.cc:67:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   67 |       if (i = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:70:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   70 |       if (k = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:73:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   73 |       if (l = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:92:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   92 |     if (strc2.at(1) == ".") {
      |         ~~~~~~~~~~~~^~~~~~
a.cc:98:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   98 |       if (g = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:101:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  101 |       if (h = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:104:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  104 |       if (j = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:107:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  107 |       if (l = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:110:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  110 |       if (m = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:122:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  122 |     if (strc2.at(2) == ".") {
      |         ~~~~~~~~~~~~^~~~~~
a.cc:131:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  131 |       if (f = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:134:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  134 |       if (g = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:137:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  137 |       if (h = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:140:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  140 |       if (i = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:143:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  143 |       if (j = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:146:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  146 |       if (k = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:149:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  149 |       if (l = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:152:15: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  152 |       if (m = "#") {
      |               ^~~
      |               |
      |               const char*
a.cc:163:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  163 |    if (strc2.at(c) == ".") {
      |        ~~~~~~~~~~~~^~~~~~
a.cc:169:13: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  169 |     if (f = "#") {
      |             ^~~
      |             |
      |             const char*
a.cc:172:13: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  172 |     if (g = "#") {
      |             ^~~
      |             |
      |             const char*
a.cc:175:13: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  175 |     if (i = "#") {
      |             ^~~
      |             |
      |             const char*
a.cc:178:13: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  178 |     if (k = "#") {
      |             ^~~
      |             |
      |             const char*
a.cc:181:13: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
  181 |     if (l = "#") {
      |             ^~~
      |             |
      |             const char*
a.cc:186:9: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
  186 |    cout >> strc2 >> endl;
      |    ~~~~ ^~ ~~~~~
      |    |       |
      |    |       std::string {aka std::__cxx11::basic_string<char>}
      |    std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41,
                 from a.cc:1:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
  131 |     operator>>(byte __b, _IntegerType __shift) noexcept
      |     ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note:   template argument deduction/substitution failed:
a.cc:186:4: note:   cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
  186 |    cout >> strc2 >> endl;
      |    ^~~~
In file included from /usr/include/c++/14/string:55,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
  835 |     operator>>(basic_istream<_CharT, _Traits>& __in,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note:   template argument deduction/substitution failed:
a.cc:186:12: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
  186 |    cout >> strc2 >> endl;
      |            ^~~~~
/usr/include/c++/14/bitset:1597:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, bitset<_Nb>&)'
 1597 |     operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
      |     ^~~~~~~~
/usr/include/c++/14/bitset:1597:5: note:   template argument deduction/substitution failed:
a.cc:186:12: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
  186 |    cout >> strc2 >> endl;
      |            ^~~~~
In file included from /usr/include/c++/14/istream:1109,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
  978 |     operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
      |     ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note:   template argument deduction/substitution failed:
a.cc:186:12: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
  186 |    cout >> strc2 >> endl;
      |            ^~~~~
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
  849 |     operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
      |     ^~~