#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  string s;
  cin >> s;
  char ch, dir;
  vector<pair<char, int>> spell;
  queue<pair<int, int>> seq;
  set<pair<int, int>> mp;
  getchar();
  for (int i = 0; i < q; i++) {
    scanf("%c %c\n", &ch, &dir);
    spell.push_back(make_pair(ch, dir));
    if (ch == s[0] && dir == 'L') {
      seq.push(make_pair(0, i - 1));
      mp.insert(seq.front());
    }
    if (ch == s.back() && dir == 'R') {
      seq.push(make_pair(n - 1, i - 1));
      mp.insert(seq.front());
    }
  }
  int lf = -1, rf = n;
  vector<int> vis(n, 0);
  while (seq.size()) {
    pair<int, int> now = seq.front();
    seq.pop();
    int pos = now.first;
    int spe = now.second;
    vis[pos] = 1;
    if (spe < 0) {
      continue;
    }
    if (spell[spe].second == 'L' && pos < n - 1 &&
        s[pos + 1] == spell[spe].first) {
      pos++;
    } else if (spell[spe].second == 'R' && pos &&
               s[pos - 1] == spell[spe].first) {
      pos--;
    }
    spe--;
    pair<int, int> next = make_pair(pos, spe);
    if (!mp.count(next)) {
      seq.push(next);
      mp.insert(next);
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (!vis[i]) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
