#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long LLINF = 1e18;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<vector<int>> index(26);
  for (int i = (0); i < (n); i++) {
    index[s[i] - 'A'].push_back(i);
  }
  for (int i = (0); i < (26); i++) sort((index[i]).begin(), (index[i]).end());
  int cnt[n];
  for (int i = (0); i < (n); i++) cnt[i] = 1;
  int ans = 0;
  for (int i = (0); i < (q); i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'R') {
      for (int j = (index[t - 'A'].size() - 1); j >= (0); j--) {
        if (index[t - 'A'][j] == n - 1) {
          ans += cnt[index[t - 'A'][j]];
        } else {
          cnt[index[t - 'A'][j] + 1] += cnt[index[t - 'A'][j]];
        }
        cnt[index[t - 'A'][j]] = 0;
      }
    } else {
      for (int j = (0); j < ((int)index[t - 'A'].size()); j++) {
        if (index[t - 'A'][j] == 0) {
          ans += cnt[index[t - 'A'][j]];
        } else {
          cnt[index[t - 'A'][j] - 1] += cnt[index[t - 'A'][j]];
        }
        cnt[index[t - 'A'][j]] = 0;
      }
    }
  }
  cout << (n - ans) << endl;
  return 0;
}
