#include <bits/stdc++.h>
using ll = unsigned long long;
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<vector<int>> vec(26);
  for (int i = 0; i < n; i++) {
    int x = s[i] - 'A';
    vec[x].push_back(i);
  }
  vector<int> reg(n, 1);
  int c = 0;
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    int x = t - 'A';
    vector<int> reg1(n);
    for (int i = 0; i < n; i++) {
      reg1[i] = reg[i];
    }
    for (int j = 0; j < (int)vec[x].size(); j++) {
      if (d == 'L') {
        if (vec[x][j] == 0) {
          c += reg[0];
          reg1[0] = 0;
          continue;
        } else {
          reg1[vec[x][j] - 1] += reg[vec[x][j]];
          reg1[vec[x][j]] = 0;
        }
      } else {
        if (vec[x][j] == n - 1) {
          c += reg[n - 1];
          reg1[0] = 0;
          continue;
        } else {
          reg1[vec[x][j] + 1] += reg[vec[x][j]];
          reg1[vec[x][j]] = 0;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      reg[i] = reg1[i];
    }
  }
  cout << n - c << endl;
}
