#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
	ll n,q;
	cin >> n >> q;
	string a;
	cin >> a;
	vector <string> left;
	vector <string> right;
	for (int z=0;z<q;z++){
		string b,c;
		cin >> b >> c;
		if (c == "R"){
			right.push_back(b);
		} else {
			left.push_back(b);
		}
	}
	ll cu = left.size()-1;
	ll count = 0;
	for (int z=0;z<n;z++){
		while (cu > -1 && left[cu][0] != a[z]){
			cu--;
		}
		if (cu > -1)
		count++;
	}
	cu = 0;
	for (int z=n-1;z>-1;z--){
		while (cu < right.size() && right[cu][0] != a[z]){
			cu++;
		}
		if (cu < right.size())
		count++;
	}
	cout << max(0,n-count) << endl;
	cin >> n;
}
