#include using namespace std; const int N = 400010; char s[N]; bool used[N]; int main() { int n, m; scanf("%d%d", &n, &m); scanf("%s", s); deque w, a, c; int all = n + n + m + m; for (int i = 0; i < all; i++) { if (s[i] == 'W') w.push_back(i); else if (s[i] == 'A') a.push_back(i); else if (s[i] == 'C') c.push_back(i); } bool ok = true; for (int i = 0; i < all; i++) { if (used[i]) continue; if (s[i] == 'C') { ok = false; break; } if (s[i] == 'A') { if (c.empty()) { ok = false; break; } used[c.front()] = true; c.pop_front(); used[a.front()] = true; a.pop_front(); } else { if (a.empty()) { ok = false; break; } used[w.front()] = true; w.pop_front(); used[a.back()] = true; a.pop_back(); } } ok &= w.empty() && a.empty() && c.empty(); if (ok) printf("Yes\n"); else printf("No\n"); return 0; }