#define BOX_MAX (200000)

static void C_SnukeTheWizard();

int main()
{
	C_SnukeTheWizard();

	return 0;
}

static void C_SnukeTheWizard()
{
	int N = 0, Q = 0;
	int sum = 0;
	char t = 0, d = 0, cr = 0;
	
	static int gorem[BOX_MAX] = { 0 };
	static char s[BOX_MAX + 1] = { 0 };

	scanf("%d %d", &N, &Q);
	scanf("%s", s);


	for (int i = 0; i < N; i++) {
		gorem[i] = 1;
	}
	sum = N;

	for (int i = 0; i < Q; i++) {
		scanf(" %c %c", &t, &d);

		if (d == 'R') {
			
			if (s[N - 1] == t) {
				sum -= gorem[N - 1];
				gorem[N - 1] = 0;
			}
			
			for (int p = N - 2; p >= 0; p--) {
				if (s[p] == t) {
					gorem[p + 1] += gorem[p];
					gorem[p] = 0;
				}
			}
		}
		else {
			if (s[0] == t) {
				sum -= gorem[0];
				gorem[0] = 0;
			}
			
			for (int p = 1; p < N; p++) {
				if (s[p] == t) {
					gorem[p - 1] += gorem[p];
					gorem[p] = 0;
				}
			}
		}
	}


	printf("%d\n", sum);
	fflush(stdout);

	return;
}

