#include #include #define elif else if #define ll long long #define vll vector #define vec vector #define embk emplace_back #define rep(i, n) for (int i = 0; i < n; i++) #define rep3(i, n, k) for (int i = k; i < n; i++) #define all(a) a.begin(), a.end() using namespace std; using namespace atcoder; const ll INF = 1LL << 60; const ll mod = 998244353; int main() { ll n, m; cin >> n >> m; string s; cin >> s; ll ss = s.size(); vec used(ss); deque posa; ll count = 0; rep(i, ss) { if (s[ss-i-1] == 'A') { count++; posa.push_back(ss-i-1); } elif (s[ss-i-1] == 'W') { count--; if (count < 0) { cout << "No" << endl; return 0; } used[posa.front()] = 1; posa.pop_front(); } } rep(i, ss) { if (s[i] == 'C') { if (posa.back() < i) { used[posa.back()]; posa.pop_back(); } else { cout << "No" << endl; return 0; } } } cout << "Yes" << endl; }