#include <bits/stdc++.h>
using namespace std;
int g[200005] = {0};
vector<int> idx[26];
int main() {
  int n, q;
  char t, d;
  string s;
  cin >> n >> q >> s;
  for (int i = 0; i < n; ++i) {
    g[i] = 1;
    idx[s[i] - 'A'].push_back(i);
  }
  for (int i = 0; i < q; ++i) {
    cin >> t >> d;
    vector<int> v = idx[t - 'A'];
    for (vector<int>::iterator it = v.begin(); it != v.end(); ++it) {
      if (d == 'L') {
        if (*it > 0) {
          g[*it - 1] += g[*it];
        }
      }
      if (d == 'R') {
        if (*it < n - 1) {
          g[*it + 1] += g[*it];
        }
      }
      g[*it] = 0;
    }
  }
  int answer = 0;
  for (int i = 0; i < n; ++i) {
    answer += g[i];
  }
  cout << answer << endl;
}
