#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); long long N, M; string S; cin >> N >> M >> S; long long needWA = N, needAC = M; deque W_queue; // positions of unpaired W for WA deque A_queue; // positions of unpaired A for AC for (char ch : S) { if (ch == 'W') { W_queue.push_back(1); // we only care about count, position not needed } else if (ch == 'A') { if (needWA > 0 && !W_queue.empty()) { // pair earliest W with this A to form WA needWA--; W_queue.pop_front(); } else { // keep this A for future AC A_queue.push_back(1); } } else if (ch == 'C') { if (needAC > 0 && !A_queue.empty()) { // pair earliest available A with this C to form AC needAC--; A_queue.pop_front(); } else { cout << "No\n"; return 0; } } } if (needWA == 0 && needAC == 0) cout << "Yes\n"; else cout << "No\n"; return 0; }