#include #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define all(obj) (obj).begin(), (obj).end() using ll = long long; using namespace std; int main() { int H,W;cin>>H>>W; vector S(H); string left = "9yiwiy"; string right = "yiwiy9"; rep(i,H) cin>>S[i]; for(int y = 0; y < H; y++){ for(int x = 0; x < W-5; ){ bool update = false; if(S[y].substr(x,6) == left){ S[y][x+1]= 'Y'; update = true; x+=6; } if(S[y].substr(x,6) == right){ S[y][x+4]= 'Y'; update = true; x+=6; } if(!update)x++; } } for(auto s:S){ cout << s << endl; } }