#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 10;
set<int> a[N];
int b[N];
char s[N];
int main() {
  ios::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) a[s[i] - 'A'].insert(i), b[i] = 1;
  while (m--) {
    char x, y;
    cin >> x >> y;
    vector<pair<int, int> > v;
    for (int i : a[x - 'A']) {
      v.push_back({i, b[i]});
      b[i] = 0;
    }
    for (auto i : v) {
      int p = (y == 'L') ? (i.first - 1) : (i.first + 1);
      if (p < 0 || p >= n) continue;
      if (b[p] == 0) a[s[p] - 'A'].insert(p);
      b[p] += i.second;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += b[i];
  }
  cout << ans << endl;
}
