#include <bits/stdc++.h>
using namespace std;
void disp(vector<int> v) {
  for (int i : v) {
    cout << i << " ";
  }
  cout << endl;
}
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  map<char, vector<int>> dict;
  for (int i = 0; i < s.size(); i++) {
    dict[s[i]].push_back(i);
  }
  vector<char> T;
  vector<char> D;
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    T.push_back(t);
    D.push_back(d);
  }
  vector<int> G(N, 1);
  int result = N;
  for (int i = 0; i < Q; i++) {
    char t = T[i];
    char d = D[i];
    for (int j : dict[t]) {
      int temp = G[j];
      G[j] = 0;
      if (d == 'L') {
        if (j == 0) {
          result -= temp;
        } else {
          G[j - 1] += temp;
        }
      } else if (d == 'R') {
        if (j == N - 1) {
          result -= temp;
        } else {
          G[j + 1] += temp;
        }
      } else {
        cout << "error1" << endl;
      }
    }
  }
  cout << result << endl;
  return 0;
}
