Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

int sousa(char *c,int i,int j,int cnt){
  if(c[i,j]=='.'){
    if(i>0){
      if(j>0){
        return max({sousa(c,i-1,j,cnt+1),sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      }else{
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i-1,j,cnt+1)});
      }
    }else{
      if(j>0){
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      }else{
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)});
      }
    }
  }else{
    return cnt;
  }
}
  
        

int main(){
  int h, w;
  cin >> h >> w;
  char c[h,w];
  int i,j;
  for(i=0;i<h;i++) for(j=0;j<w;j++) cin >> c[i,j];
  int ans = 0;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      ans = max(ans,sousa(c,i,j,0));
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int sousa(char*, int, int, int)':
a.cc:9:83: error: expected '}' before 'sousa'
    9 |         return max({sousa(c,i-1,j,cnt+1),sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      |                    ~                                                              ^~~~~
a.cc:9:83: error: expected ')' before 'sousa'
    9 |         return max({sousa(c,i-1,j,cnt+1),sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      |                   ~                                                               ^~~~~
      |                                                                                   )
a.cc:9:103: error: expected ';' before '}' token
    9 |         return max({sousa(c,i-1,j,cnt+1),sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      |                                                                                                       ^
      |                                                                                                       ;
a.cc:9:104: error: expected primary-expression before ')' token
    9 |         return max({sousa(c,i-1,j,cnt+1),sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      |                                                                                                        ^
a.cc:15:62: error: expected '}' before 'sousa'
   15 |         return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      |                    ~                                         ^~~~~
a.cc:15:62: error: expected ')' before 'sousa'
   15 |         return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      |                   ~                                          ^~~~~
      |                                                              )
a.cc:15:82: error: expected ';' before '}' token
   15 |         return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      |                                                                                  ^
      |                                                                                  ;
a.cc:15:83: error: expected primary-expression before ')' token
   15 |         return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      |                                                                                   ^
a.cc:16:8: error: 'else' without a previous 'if'
   16 |       }else{
      |        ^~~~
a.cc: At global scope:
a.cc:20:3: error: expected declaration before '}' token
   20 |   }else{
      |   ^
a.cc:20:4: error: expected unqualified-id before 'else'
   20 |   }else{
      |    ^~~~
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
a.cc: In function 'int main()':
a.cc:30:11: error: expected ']' before ',' token
   30 |   char c[h,w];
      |           ^
      |           ]
a.cc:30:13: error: expected initializer before ']' token
   30 |   char c[h,w];
      |             ^
a.cc:32:44: error: 'c' was not declared in this scope
   32 |   for(i=0;i<h;i++) for(j=0;j<w;j++) cin >> c[i,j];
      |                                            ^
a.cc:36:27: error: 'c' was not declared in this scope
   36 |       ans = max(ans,sousa(c,i,j,0));
      |                           ^