#include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace atcoder; typedef long long ll; #define rep(i,n) for (int i = 0; i < int(n);i++) const int INF = 1e9; int main(){ int n,m; cin >> n >> m; string s; cin >> s; int len = n+m+n+m; set st; bool yes = true; for (int i = len-1; i >= 0;i--){ //cout << i; //cout << " set:" << endl; //for (auto e:st){ // cout << e << " "; //} //cout << endl; if (s[i] == 'A'){ st.insert(i); } else if (s[i] == 'W'){ if (st.empty()){ yes = false; break; } else{ auto itr = st.rbegin(); st.erase((*itr)); } } } for (int i = 0; i < len;i++){ if (s[i] == 'C'){ if (st.empty()){ yes = false; break; } else{ st.erase(st.begin()); } } } if (yes){ cout << "Yes\n"; } else{ cout << "No\n"; } return 0; }