#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int first;
  int second;
  int third;
} T;
bool comp_Se(T& l, T& r) { return l.second < r.second; }
int main(void) {
  int i, j, N, Q;
  string s;
  cin >> N >> Q;
  cin >> s;
  int count = N;
  vector<int> stat(N, 1);
  map<char, vector<int> > pos;
  for (i = 0; i < N; i++) {
    pos[s[i]].push_back(i);
  }
  for (i = 0; i < Q; i++) {
    char x, y;
    cin >> x >> y;
    for (j = 0; j < pos[x].size(); j++) {
      if (y == 'R') {
        if (pos[x][j] == N - 1) {
          count -= stat[pos[x][j]];
          stat[pos[x][j]] = 0;
        } else {
          stat[pos[x][j] + 1] += stat[pos[x][j]];
          stat[pos[x][j]] = 0;
        }
      } else {
        if (pos[x][j] == 0) {
          count -= stat[pos[x][j]];
          stat[pos[x][j]] = 0;
        } else {
          stat[pos[x][j] - 1] += stat[pos[x][j]];
          stat[pos[x][j]] = 0;
        }
      }
    }
  }
  cout << count << endl;
  return 0;
}
