#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;
}