#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 1;
char s[N];
int main(int argc, char **argv) {
int T;
scanf("%d", &T);
while (T-- != 0) {
int n, m;
scanf("%d%d%s", &n, &m, s);
int ok = 0, need = (n + 1) >> 1;
for (int i = 0; i * 2 < n; ++i)
if (s[i] == s[n - i - 1])
++ok;
int res = 0, p;
char c;
for (int i = 0; i < m; ++i) {
scanf("%d %c", &p, &c);
--p;
if (p != n - p - 1 && s[p] != s[n - p - 1] && s[n - p - 1] == c)
++ok;
if (p != n - p - 1 && s[p] == s[n - p - 1] && s[n - p - 1] != c)
--ok;
s[p] = c;
if (ok == need)
++res;
}
printf("%d\n", res);
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKCmNvbnN0IGludCBOID0gMWU1ICsgMTsKY2hhciBzW05dOwoKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKiphcmd2KSB7CglpbnQgVDsKCXNjYW5mKCIlZCIsICZUKTsKCXdoaWxlIChULS0gIT0gMCkgewoJCWludCBuLCBtOwoJCXNjYW5mKCIlZCVkJXMiLCAmbiwgJm0sIHMpOwoJCWludCBvayA9IDAsIG5lZWQgPSAobiArIDEpID4+IDE7CgkJZm9yIChpbnQgaSA9IDA7IGkgKiAyIDwgbjsgKytpKQoJCQlpZiAoc1tpXSA9PSBzW24gLSBpIC0gMV0pCgkJCQkrK29rOwoJCWludCByZXMgPSAwLCBwOwoJCWNoYXIgYzsKCQlmb3IgKGludCBpID0gMDsgaSA8IG07ICsraSkgewoJCQlzY2FuZigiJWQgJWMiLCAmcCwgJmMpOwoJCQktLXA7CgkJCWlmIChwICE9IG4gLSBwIC0gMSAmJiBzW3BdICE9IHNbbiAtIHAgLSAxXSAmJiBzW24gLSBwIC0gMV0gPT0gYykKCQkJCSsrb2s7CgkJCWlmIChwICE9IG4gLSBwIC0gMSAmJiBzW3BdID09IHNbbiAtIHAgLSAxXSAmJiBzW24gLSBwIC0gMV0gIT0gYykKCQkJCS0tb2s7CgkJCXNbcF0gPSBjOwoJCQlpZiAob2sgPT0gbmVlZCkKCQkJCSsrcmVzOwoJCX0KCQlwcmludGYoIiVkXG4iLCByZXMpOwoJfQoJcmV0dXJuIDA7Cn0=