#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  string c;
  cin >> a >> b >> c;
  pair<char, char> f[b];
  pair<char, int> g[a];
  char d, e;
  for (int i = 0; i < b; i++) {
    cin >> d >> e;
    f[i] = make_pair(d, e);
  }
  for (int i = 0; i < a; i++) {
    g[i] = make_pair(c[i], 1);
  }
  for (int i = 0; i < b; i++) {
    for (int j = 0; j < a; j++) {
      if (c[j] == f[i].first) {
        if (f[i].second == 'L' && j != 0) {
          g[j - 1].second += g[j].second;
        }
        if (f[i].second == 'R' && j != a) {
          g[j + 1].second += g[j].second;
        }
        g[j].second = 0;
      }
    }
  }
  int h = 0;
  for (int i = 0; i < a; i++) {
    h += g[i].second;
  }
  cout << h << endl;
  return 0;
}
