#include <bits/stdc++.h>
using namespace std;
int const N = 2e5 + 1;
int n, q;
string s;
map<int, int> ad, rem;
int main() {
  scanf("%d%d", &n, &q);
  cin >> s;
  int gol = n;
  map<char, vector<int> > mp;
  for (int i = 0; i < n; ++i) {
    mp[s[i]].push_back(i);
    ad[i] = 1;
  }
  for (int i = 0; i < q; ++i) {
    char x, tp;
    cin >> x >> tp;
    int val = (tp == 'L' ? -1 : 1);
    for (auto j : mp[x]) {
      int pos = j + val;
      if (pos < 0 || pos > n) {
        gol -= ad[j];
        ad[j] = 0;
        continue;
      }
      int have = ad[j];
      ad[j] = 0;
      ad[pos] += have;
    }
  }
  int an = 0;
  for (int i = 0; i < n; ++i) an += ad[i];
  cout << an;
  return 0;
}
