#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  pair<char, int> p[N + 2];
  p[0].first = ' ';
  p[0].second = -1010101;
  p[1 + N].first = ' ';
  p[1 + N].second = -1010101;
  for (int i = 1; i < N + 1; i++) {
    p[i].first = s[i];
    p[i].second = 1;
  }
  vector<char> t(Q), d(Q);
  for (int i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
    for (int j = 0; j < N + 1; j++) {
      if (p[j].first == t[i] && d[i] == 'L') {
        p[j - 1].second++;
        p[j].second--;
      }
      if (p[j].first == t[i] && d[i] == 'R') {
        p[j + 1].second++;
        p[j].second--;
      }
    }
  }
  int cnt = 0;
  for (int i = 1; i < N + 1; i++) {
    cnt += p[i].second;
  }
  cout << cnt << endl;
  return 0;
}
