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