#include <bits/stdc++.h>
using namespace std;
long long w = 1000000000 + 7;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<vector<int>> a(26);
  for (int i = 0; i < n; i++) {
    a[s[i] - 65].push_back(i);
  }
  vector<int> pos(n, 1);
  int ans = 0;
  char t, d;
  for (int i = 0; i < q; i++) {
    cin >> t >> d;
    if (d == 'L') {
      for (int j = 0; j < a[t - 65].size(); j++) {
        if (a[t - 65][j] == 0) {
          ans = ans + pos[0];
          pos[0] = 0;
        } else {
          pos[a[t - 65][j] - 1] = pos[a[t - 65][j] - 1] + pos[a[t - 65][j]];
          pos[a[t - 65][j]] = 0;
        }
      }
    } else {
      for (int j = a[t - 65].size() - 1; j >= 0; j--) {
        if (a[t - 65][j] == n - 1) {
          ans = ans + pos[n - 1];
          pos[n - 1] = 0;
        } else {
          pos[a[t - 65][j] + 1] = pos[a[t - 65][j] + 1] + pos[a[t - 65][j]];
          pos[a[t - 65][j]] = 0;
        }
      }
    }
  }
  ans = n - ans;
  cout << ans << endl;
  return 0;
}
