#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 100000 + 5;
char st[N];
bool other[N];
int n, m, res, cnt, ti;
char c;
int O(int i) { return n-i-1; }
int main() {
int T;
scanf("%d", &T);
while(T--) {
scanf("%d%d%s", &n,&m,st);
for(int i=0; i<n; ++i)
other[i] = true;
cnt = 0;
for(int i=0; i<=O(i); ++i)
if(st[i] != st[O(i)]) {
other[i] = other[O(i)] = false;
++cnt;
}
res = 0;
for(int j=0; j<m; ++j) {
scanf("%d %c", &ti, &c);
--ti;
st[ti] = c;
if(other[ti] == true) {
if(st[ti] != st[O(ti)]) {
other[ti] = other[O(ti)] = false;
++cnt;
}
} else if(other[ti] == false) {
if(st[ti] == st[O(ti)]) {
other[ti] = other[O(ti)] = true;
--cnt;
}
}
if(cnt == 0) ++res;
}
printf("%d\n", res);
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnR5cGVkZWYgbG9uZyBsb25nIGxsOwp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjb25zdCBpbnQgTiA9IDEwMDAwMCArIDU7CmNoYXIgc3RbTl07CmJvb2wgb3RoZXJbTl07CmludCBuLCBtLCByZXMsIGNudCwgdGk7CmNoYXIgYzsKaW50IE8oaW50IGkpIHsgcmV0dXJuIG4taS0xOyB9CmludCBtYWluKCkgewoJaW50IFQ7CglzY2FuZigiJWQiLCAmVCk7Cgl3aGlsZShULS0pIHsKCQlzY2FuZigiJWQlZCVzIiwgJm4sJm0sc3QpOwoJCWZvcihpbnQgaT0wOyBpPG47ICsraSkKCQkJb3RoZXJbaV0gPSB0cnVlOwoJCWNudCA9IDA7CgkJZm9yKGludCBpPTA7IGk8PU8oaSk7ICsraSkKCQkJaWYoc3RbaV0gIT0gc3RbTyhpKV0pIHsKCQkJCW90aGVyW2ldID0gb3RoZXJbTyhpKV0gPSBmYWxzZTsKCQkJCSsrY250OwoJCQl9CgkJcmVzID0gMDsKCQlmb3IoaW50IGo9MDsgajxtOyArK2opIHs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