#include <iostream>
#include <string>
#include <vector>
#include <map>
typedef pair<char, char> cc;
typedef pair<char, int> ci;
using namespace std;

int main()
{
    int n, q;
	cin >> n >> q;
	string s;
	cin >> s;
    vector<ci> spaces;
	vector<cc> moves;

	for(int i = 0; i < q; ++i){
		cc pair;
		cin >> pair.first >> pair.second;
		moves.push_back(pair);
	}
	for (int i = 0; i < s.length(); ++i){
		spaces.push_back(ci(s[i], 1));
	}

	for (int i = 0; i < q; ++i){
		auto move = moves[i];
		for (int j = 0; j < n; ++j){
			if (move.first == spaces[j].first){
					spaces[j].second--;
				if (move.second == 'L'){
					if (j > 0){
						spaces[j-1].second++;
					}

				} else { // R
					if (j < n - 1){
						spaces[j+1].second++;
					}
				}
			}
		}
	}

	int sum = 0;
	for (int i = 0; i < n; ++i){
		sum += spaces[i].second;
	}
	cout << sum;
}