#if __has_include() #include using namespace atcoder; #else #include #if __has_include() #include using namespace atcoder; #endif #endif using namespace std; #define int long long #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for(int i = (int)((n) - 1); i >= 0; i--) template bool chmax(T &a,const T &b){if(a bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} // using mint = modint; signed main(){ int n, m; string s, t; cin >> n >> m >> s >> t; if(t == "Warong"){ rep(i, m) s.at(i) = 'A'; // ?が1文字で、他がすべてAならその?はWになる int q_cnt = 0, w_cnt = 0; for(auto c : s){ q_cnt += c == '?'; w_cnt += c == 'W'; } if(q_cnt == 1 && w_cnt == 0){ for(auto&& c : s) if(c == '?') c = 'W'; } } if(t == "NotWarong"){ // 最初のM文字に1文字以上Wが含まれる || すべてAである int w_cnt = 0; for(auto c : s) w_cnt += c == 'W'; if(w_cnt == 0){ // すべてAの可能性がある // 後半にWが入り、かつ前半M文字がすべてAだとアウト int a_front_cnt = 0; rep(i, m) a_front_cnt += s.at(i) == 'A'; if(a_front_cnt == m){ for(int i = m; i < n; i++) s.at(i) = 'A'; } } else{ // すでにWがあるので、後半の条件は達成されない // 前半のM文字に1文字以上Wが含まれる必要がある // 前半にWがなく前半の?が1文字ならそれをWにする int q_front_cnt = 0, w_front_cnt = 0; rep(i, m){ q_front_cnt += s.at(i) == '?'; w_front_cnt += s.at(i) == 'W'; } if(q_front_cnt == 1 && w_front_cnt == 0){ rep(i, m) if(s.at(i) == '?') s.at(i) = 'W'; } } } println("{}", s); }