#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, Q; cin >> N >> Q;
	string s; cin >> s;
	vector<char> t(Q), d(Q); rep(i, 0, Q) {
		cin >> t[i] >> d[i];
	}

	int l = 0, r = 0;
	vector<bool> f(26);
	rrep(i, 0, Q) {
		char c = d[i] - 'A';
		if (d[i] == 'L') {
			if (s[l] == t[i]) {
				if (f[s[l] - 'A'])
					f[s[l] - 'A'] = false;
				l++;
			}
		}
		else {
			f[c] = true;
		}
	}
	dump(l);
	f.assign(26, false);
	rrep(i, 0, Q) {
		char c = d[i] - 'A';
		if (d[i] == 'R') {
			if (s[N - 1 - r] == t[i]) {
				if (f[s[N - 1 - r] - 'A'])
					f[s[N - 1 - r] - 'A'] = false;
				r++;
			}
		}
		else {
			f[c] = true;
		}
	}
	dump(r);
	cout << N - l - r << endl;
	return 0;
}