#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, q;
  string s;
  cin >> n >> q >> s;
  char t, d;
  int count_g[n], ssize = s.size();
  for (int i = 0; i < n; i++) count_g[i] = 1;
  int j;
  unordered_map<char, vector<int> > map_g;
  for (int i = 0; i < s.size(); i++) {
    map_g[s[i]].push_back(i);
  }
  for (int i = 0; i < q; i++) {
    cin >> t >> d;
    if (d == 'R') {
      for (int x : map_g[t]) {
        if (x != ssize - 1) {
          count_g[x + 1] += count_g[x];
        }
        count_g[x] = 0;
      }
    } else {
      for (int x : map_g[t]) {
        if (x != 0) {
          count_g[x - 1] += count_g[x];
        }
        count_g[x] = 0;
      }
    }
  }
  int sum = 0;
  for (int x : count_g) sum += x;
  cout << sum << endl;
  return 0;
}
