Language: C++

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

int main() {
  string 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;  
  //(一文字目はじめ)=============================================================
    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文字目終わり)==========================================================
  //(last列始め)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
}



Compiler output:
a.cc: In function 'int main()':
a.cc:10:6: error: ambiguous overload for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
   10 |   cu=0;
      |      ^
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  817 |       operator=(const basic_string& __str)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  828 |       operator=(const _CharT* __s)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  840 |       operator=(_CharT __c)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  858 |       operator=(basic_string&& __str)
      |       ^~~~~~~~
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:18:7: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   18 |     cu++;
      |     ~~^~
a.cc:22:11: error: could not convert 'j.std::__cxx11::basic_string<char>::operator=(((const char*)"#"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   22 |     if (j = "#") {
      |         ~~^~~~~
      |           |
      |           std::__cxx11::basic_string<char>
a.cc:23:9: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   23 |       cu++;
      |       ~~^~
a.cc:25:11: error: could not convert 'l.std::__cxx11::basic_string<char>::operator=(((const char*)"#"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   25 |     if (l = "#") {
      |         ~~^~~~~
      |           |
      |           std::__cxx11::basic_string<char>
a.cc:26:9: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   26 |       cu++;
      |       ~~^~
a.cc:28:11: error: could not convert 'm.std::__cxx11::basic_string<char>::operator=(((const char*)"#"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   28 |     if (m = "#") {
      |         ~~^~~~~
      |           |
      |           std::__cxx11::basic_string<char>
a.cc:29:9: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   29 |       cu++;
      |       ~~^~
a.cc:31:18: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
   31 |     stra.at(1) = cu;
      |                  ^~
      |                  |
      |                  std::string {aka std::__cxx11::basic_string<char>}
a.cc:35:21: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
   35 |   for (int i = 0;i<b-2;i++) {
      |                    ~^~
      |                    | |
      |                    | int
      |                    std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:35:22: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
   35 |   for (int i = 0;i<b-2;i++) {
      |                      ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:35:22: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
   35 |   for (int i = 0;i<b-2;i++) {
      |                      ^
In file included from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)'
  370 |     operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:370:5: note:   template argument deduction/substitution failed:
a.cc:35:22: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
   35 |   for (int i = 0;i<b-2;i++) {
      |                      ^
/usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)'
  379 |     operator-(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:379:5: note:   template argument deduction/substitution failed:
a.cc:35:22: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
   35 |   for (int i = 0;i<b-2;i++) {
      |                      ^
/usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)'
  388 |     operator-(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:388:5: note:   template argument deduction/substitution failed:
a.cc:35:22: note:   mismatched types 'const std::complex<_Tp>' and 'int'
   35 |   for (int i = 0;i<b-2;i++) {
      |                      ^
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
  465 |     operator-(const complex<_Tp>& __x)
      |     ^~~~~~~~
/usr/include/c++/14/complex:465:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/valarray:605,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
  406 |     _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note:   template argument deduction/substitution failed:
a.cc:35:22: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   35 |   for (int i = 0;i<b-2;i++) {
      |                      ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
  406 |     _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note:   template argument deduction/substitution failed:
a.cc:35:22: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   35 |   for (int i = 0;i<b-2;i++) {
      |                      ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
  406 |     _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note:   template argument deduction/substitution failed:
a.cc:35:22: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
   35 |   for (int i = 0;i<b-2;i++) {
      |                      ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray