Language: C++

#include<iostream>
#include<string>

#define NMAX 1010

int n;
string sqs[NMAX];
int sqi[NMAX][NMAX];
int c;
int max;

using namespace std;

int main(){

    while(1){

        cin>>n;
        if(n==0) break;

        for(int i=0;i<n;i++){
            cin>>sqs[i];
        }

        for(int i=0;i<n;i++){
            sqi[i][0]=1;
	    c=2;
            for(int j=1;j<n;j++){
	      if(sqs[i][j]=='.') sqi[i][j]=c++;
	      else sqi[i][j]=0,c=1;
            }
        }

	max=0;

	for(int i=0;i<n;i++){
	  for(int j=0;j<n;j++){
	    /*(i,j) 左上*/
	    for(int k=0;i+k<n||j+k<n;k++){
	      if(k+1<=max) continue;
	      /*(i+k,j+k) 右下*/
	      bool f=true;
	      for(int l=0;l<=k&&f;l++){
		if(sqs[i+l][j]=='*'||sqs[i+l][j+k]=='*'||sqi[i+l][j]+k!=sqi[i+l][j+k]) f=false;
	      }
	      if(f) max=k+1;
	      else break;
	    }
         }
      }
	cout<<max<<endl;
    }
}

Compiler output:
a.cc:7:1: error: 'string' does not name a type; did you mean 'stdin'?
    7 | string sqs[NMAX];
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc:22:18: error: 'sqs' was not declared in this scope; did you mean 'sqi'?
   22 |             cin>>sqs[i];
      |                  ^~~
      |                  sqi
a.cc:29:18: error: 'sqs' was not declared in this scope; did you mean 'sqi'?
   29 |               if(sqs[i][j]=='.') sqi[i][j]=c++;
      |                  ^~~
      |                  sqi
a.cc:34:9: error: reference to 'max' is ambiguous
   34 |         max=0;
      |         ^~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:10:5: note:                 'int max'
   10 | int max;
      |     ^~~
a.cc:40:23: error: reference to 'max' is ambiguous
   40 |               if(k+1<=max) continue;
      |                       ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:10:5: note:                 'int max'
   10 | int max;
      |     ^~~
a.cc:44:20: error: 'sqs' was not declared in this scope; did you mean 'sqi'?
   44 |                 if(sqs[i+l][j]=='*'||sqs[i+l][j+k]=='*'||sqi[i+l][j]+k!=sqi[i+l][j+k]) f=false;
      |                    ^~~
      |                    sqi
a.cc:46:21: error: reference to 'max' is ambiguous
   46 |               if(f) max=k+1;
      |                     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:10:5: note:                 'int max'
   10 | int max;
      |     ^~~
a.cc:51:15: error: reference to 'max' is ambiguous
   51 |         cout<<max<<endl;
      |               ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:10:5: note:                 'int max'
   10 | int max;
      |     ^~~