Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;

const int maxn = 103;

char map[maxn][maxn];
int move [][2] = {{0,1},{1,0},{0,-1},{-1,0}};
int n , m;
int ans;

void dfs ( int i , int j ){
	char temp = map[i][j];
	map[i][j] = '.';
	for(int k = 0 ; k < 4 ; k ++){
		if((i+move[k][0]>0)&&(i+move[k][0]<=n)&&(j+move[k][1]>0)&&(j+move[k][1]<=m)&&map[i+move[k][0]][j+move[k][1]]==temp){
			dfs(i+move[k][0],j+move[k][1]);
		}
	}
}



int main(void){
	while(cin>>n>>m){
		if((!n)&&(!m))break;
		ans = 0;
		for(int i = 1 ; i <= n ; i ++){
			for(int j = 1 ; j <= m ; j ++){
				cin>>map[i][j];
			}
		}
		for(int i = 1 ; i <= n ; i ++){
			for(int j = 1 ; j <= m ; j ++){
				if(map[i][j]!='.'){
					dfs(i,j);
					ans++;
				}
			}
		}
		cout<<ans<<endl;
	}
		
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:17:23: error: reference to 'move' is ambiguous
   17 |                 if((i+move[k][0]>0)&&(i+move[k][0]<=n)&&(j+move[k][1]>0)&&(j+move[k][1]<=m)&&map[i+move[k][0]][j+move[k][1]]==temp){
      |                       ^~~~
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:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:9:5: note:                 'int move [4][2]'
    9 | int move [][2] = {{0,1},{1,0},{0,-1},{-1,0}};
      |     ^~~~
a.cc:17:41: error: reference to 'move' is ambiguous
   17 |                 if((i+move[k][0]>0)&&(i+move[k][0]<=n)&&(j+move[k][1]>0)&&(j+move[k][1]<=m)&&map[i+move[k][0]][j+move[k][1]]==temp){
      |                                         ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:9:5: note:                 'int move [4][2]'
    9 | int move [][2] = {{0,1},{1,0},{0,-1},{-1,0}};
      |     ^~~~
a.cc:17:60: error: reference to 'move' is ambiguous
   17 |                 if((i+move[k][0]>0)&&(i+move[k][0]<=n)&&(j+move[k][1]>0)&&(j+move[k][1]<=m)&&map[i+move[k][0]][j+move[k][1]]==temp){
      |                                                            ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:9:5: note:                 'int move [4][2]'
    9 | int move [][2] = {{0,1},{1,0},{0,-1},{-1,0}};
      |     ^~~~
a.cc:17:78: error: reference to 'move' is ambiguous
   17 |                 if((i+move[k][0]>0)&&(i+move[k][0]<=n)&&(j+move[k][1]>0)&&(j+move[k][1]<=m)&&map[i+move[k][0]][j+move[k][1]]==temp){
      |                                                                              ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:9:5: note:                 'int move [4][2]'
    9 | int move [][2] = {{0,1},{1,0},{0,-1},{-1,0}};
      |     ^~~~
a.cc:17:100: error: reference to 'move' is ambiguous
   17 |                 if((i+move[k][0]>0)&&(i+move[k][0]<=n)&&(j+move[k][1]>0)&&(j+move[k][1]<=m)&&map[i+move[k][0]][j+move[k][1]]==temp){
      |                                                                                                    ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:9:5: note:                 'int move [4][2]'
    9 | int move [][2] = {{0,1},{1,0},{0,-1},{-1,0}};
      |     ^~~~
a.cc:17:114: error: reference to 'move' is ambiguous
   17 |                 if((i+move[k][0]>0)&&(i+move[k][0]<=n)&&(j+move[k][1]>0)&&(j+move[k][1]<=m)&&map[i+move[k][0]][j+move[k][1]]==temp){
      |                                                                                                                  ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:9:5: note:                 'int move [4][2]'
    9 | int move [][2] = {{0,1},{1,0},{0,-1},{-1,0}};
      |     ^~~~
a.cc:18:31: error: reference to 'move' is ambiguous
   18 |                         dfs(i+move[k][0],j+move[k][1]);
      |                               ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:9:5: note:                 'int move [4][2]'
    9 | int move [][2] = {{0,1},{1,0},{0,-1},{-1,0}};
      |     ^~~~
a.cc:18:44: error: reference to 'move' is ambiguous
   18 |                         dfs(i+move[k][0],j+move[k][1]);
      |                                            ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:9:5: note:                 'int move [4][2]'
    9 | int move [][2] = {{0,1},{1,0},{0,-1},{-1,0}};
      |     ^~~~