#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 10, q = 15;
  string s("SNCZWRCEWB");
  cin >> n >> q;
  cin >> s;
  vector<char> vt(q, 0);
  vector<char> vd(q, 0);
  for (int i = 0; i < q; ++i) {
    cin >> vt[i] >> vd[i];
  }
  vector<int> board(n, 1);
  vector<vector<int>> pos(26, vector<int>());
  for (int i = 0; i < n; ++i) {
    int p = int(s[i] - 'A');
    pos[p].push_back(i);
  }
  for (int i = 0; i < q; ++i) {
    int p = int(vt[i] - 'A');
    if (pos[p].size() == 0) {
      continue;
    }
    if (vd[i] == 'L') {
      for (int j = 0; j < pos[p].size(); ++j) {
        int idx = pos[p][j];
        if (idx > 0) {
          board[idx - 1] += board[idx];
        }
        board[idx] = 0;
      }
    } else {
      for (int j = pos[p].size() - 1; j >= 0; --j) {
        int idx = pos[p][j];
        if (idx < n - 1) {
          board[idx + 1] += board[idx];
        }
        board[idx] = 0;
      }
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    cnt += board[i];
  }
  cout << cnt << endl;
  return 0;
}
