#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  int i, j;
  char c, d;
  int temp;
  cin >> n >> q;
  int count[n];
  vector<int> _26list[26];
  for (i = 0; i < n; i++) {
    count[i] = 1;
    cin >> c;
    _26list[c - 65].push_back(i);
  }
  for (i = 0; i < q; i++) {
    cin >> c >> d;
    if (d == 'R') {
      for (j = 0; j < _26list[c - 65].size(); j++) {
        temp = _26list[c - 65][j];
        if (temp == n - 1) {
          count[temp] = 0;
        } else {
          count[temp + 1] += count[temp];
          count[temp] = 0;
        }
      }
    } else {
      for (j = 0; j < _26list[c - 65].size(); j++) {
        temp = _26list[c - 65][j];
        if (temp == 0) {
          count[temp] = 0;
        } else {
          count[temp - 1] += count[temp];
          count[temp] = 0;
        }
      }
    }
  }
  int sum = 0;
  for (i = 0; i < n; i++) {
    sum += count[i];
  }
  cout << sum;
  return 0;
}
