#include using namespace std; using ll = long long; #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define ALL(v) (v).begin(), (v).end() #define p(s) cout<<(s)<> H >> W; vector M(H); FOR(i, 0, H){ cin >> M[i]; } vector X; vector Y; FOR(i, 0, H){ string s = M[i]; FOR(j, 0, W){ char c = s[j]; if(c=='*'){ X.push_back(j); Y.push_back(i); } } } ll x, y; if(X[0]==X[1]){ // xをずらせばOK x = W-1-X[0]; y = Y[0]; } else if(Y[0]==Y[1]){ x = X[0]; y = H-1-Y[0]; } else{ x = X[0]; y = Y[1]; } FOR(i, 0, H){ string s = M[i]; if(y==i){ // 書き換え s[x] = '*'; } p(s); } return 0; }