#include using namespace std; using ll=long long; const int INF=1e9+10; const ll INFL=4e18; int main(){ int H,W;cin>>H>>W; vectorS(H); for(int i=0;i>S[i]; int id=-1; vector>par(H,vector(W,-1)); vectorsz(H*W,0); for(int i=0;i>que; que.push({i,j}); while(!que.empty()){ auto[x,y]=que.front();que.pop(); sz[id]++; for(auto[dx,dy]:{pair{0,1},{1,0},{0,-1},{-1,0}}){ int nx=x+dx,ny=y+dy; if(nx<0||nx>=H||ny<0||ny>=W)continue; if(par[nx][ny]!=-1)continue; if(S[nx][ny]!=S[x][y])continue; par[nx][ny]=id; que.push({nx,ny}); } } } for(int i=0;i=4)cout<<'.'; else cout<