#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q, ans;
  string s;
  cin >> N >> Q;
  ans = N;
  cin >> s;
  char t, d;
  vector<int> g(N, 1);
  vector<vector<int>> m(26);
  for (int i = 0; i < N; i++) {
    m[s[i] - 'A'].push_back(i);
  }
  for (int i = 0; i < Q; i++) {
    cin >> t >> d;
    int num = t - 'A';
    if (d == 'L') {
      for (int j = 0; j < (int)m[num].size(); j++) {
        int temp = m[num][j];
        if (temp > 0) {
          g[temp - 1] += g[temp];
          g[temp] = 0;
        } else {
          ans -= g[temp];
          g[temp] = 0;
        }
      }
    } else {
      for (int j = (int)m[num].size() - 1; j >= 0; j--) {
        int temp = m[num][j];
        if (temp < N - 1) {
          g[temp + 1] += g[temp];
          g[temp] = 0;
        } else {
          ans -= g[temp];
          g[temp] = 0;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
