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