#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, 0, -1};
int dy[4] = {0, 1, -1, 0};
const int INF = 1e9 + 7;
const int MOD = 10000;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<vector<int> > a(26);
  vector<int> cnt(n + 10, 1);
  cnt[0] = 0;
  cnt[n + 1] = 0;
  for (int i = 0; i < s.length(); i++) {
    a[s[i] - 'A'].push_back(i + 1);
  }
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    int ch = t - 'A';
    if (d == 'L') {
      for (int j = 0; j < a[ch].size(); j++) {
        if (cnt[a[ch][j]] > 0) {
          cnt[a[ch][j] - 1] += cnt[a[ch][j]];
          cnt[a[ch][j]] = 0;
        }
      }
    } else {
      for (int j = a[ch].size() - 1; j >= 0; j--) {
        if (cnt[a[ch][j]] > 0) {
          cnt[a[ch][j] + 1] += cnt[a[ch][j]];
          cnt[a[ch][j]] = 0;
        }
      }
    }
  }
  cout << n - cnt[0] - cnt[n + 1] << endl;
  return 0;
}
