#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, Q; cin >> N >> Q; string S; cin >> S; while (Q--) { int t, x; cin >> t >> x; if (t == 1) { int i = x - 1; S[i] = (S[i] == 'Y' ? 'N' : 'Y'); } else { int K = x; long long ans = 0; for (long long mask = 0; mask < (1LL << N); ++mask) { if (__builtin_popcountll(mask) != K) continue; int liar = 0; bool ok = true; for (int i = 0; i < N; ++i) { bool is_liar = (mask >> i) & 1; if (is_liar) { ++liar; } int honest = (i + 1) - liar; int same; if (is_liar) { same = liar; } else { same = honest; } bool correct_yes = same * 2 > i + 1; bool answer_yes; if (is_liar) { answer_yes = !correct_yes; } else { answer_yes = correct_yes; } if (answer_yes != (S[i] == 'Y')) { ok = false; break; } } if (ok) { ++ans; } } cout << ans << '\n'; } } }