#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<char> ts(Q), ds(Q);
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    ts[i] = t;
    ds[i] = d;
  }
  vector<vector<int>> char_cells(26);
  for (int i = 0; i < N; i++) {
    int char_int = s[i] - 'A';
    char_cells[char_int].push_back(i);
  }
  int ans = N;
  vector<int> cells(N, 1);
  for (int i = 0; i < Q; i++) {
    char t = ts[i];
    char d = ds[i];
    int char_int = t - 'A';
    for (int j = 0; j < char_cells[char_int].size(); j++) {
      int target = char_cells[char_int][j];
      if (d == 'L') {
        if (target == 0) {
          ans -= cells[target];
        } else {
          cells[target - 1] += cells[target];
        }
      } else {
        if (target == (N - 1)) {
          ans -= cells[target];
        } else {
          cells[target + 1] += cells[target];
        }
      }
      cells[target] = 0;
    }
  }
  cout << ans << endl;
}
