#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
int main() {
  long long N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  int ans = N;
  vector<int> p(N, 1);
  vector<vector<int>> mp(26);
  for (int i = 0; i < N; i++) {
    mp[s[i] - 'A'].push_back(i);
  }
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    for (int i_mp = 0; i_mp < mp[t - 'A'].size(); i_mp++) {
      int tar = mp[t - 'A'][i_mp];
      if (d == 'L') {
        if (tar == 0) {
          ans -= p[0];
          p[0] = 0;
        } else {
          p[tar - 1] += p[tar];
          p[tar] = 0;
        }
      } else {
        if (tar == N - 1) {
          ans -= p[tar];
          p[tar] == 0;
        } else {
          p[tar + 1] += p[tar];
          p[tar] = 0;
        }
      }
    }
  }
  cout << ans << endl;
}
