#include <bits/stdc++.h>
using namespace std;
const int8_t INFC = 0x3f;
const int16_t INFS = 0x3f3f;
const int32_t INF = 0x3f3f3f3f;
const int64_t INFL = 0x3f3f3f3f3f3f3f3fLL;
const int MAXN = 2.1e5;
vector<int> p[26];
int a[MAXN];
int main() {
  ios::sync_with_stdio(0);
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    p[s[i] - 'A'].push_back(i + 1);
  }
  for (int i = 1; i <= n; i++) {
    a[i] = 1;
  }
  while (q--) {
    char chx, chy;
    cin >> chx >> chy;
    if (chy == 'L') {
      for (int i = 0; i < p[chx - 'A'].size(); i++) {
        a[p[chx - 'A'][i] - 1] += a[p[chx - 'A'][i]];
        a[p[chx - 'A'][i]] = 0;
      }
    }
    if (chy == 'R') {
      for (int i = p[chx - 'A'].size() - 1; i >= 0; i--) {
        a[p[chx - 'A'][i] + 1] += a[p[chx - 'A'][i]];
        a[p[chx - 'A'][i]] = 0;
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += a[i];
  }
  cout << ans << endl;
  return 0;
}
