#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const long long mod = 1000000007;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> al[26];
  for (int i = 0; i < int(n); i++) {
    al[s[i] - 'A'].push_back(i);
  }
  vector<int> ans(n, 1);
  for (int i = 0; i < int(q); i++) {
    vector<int> res = ans;
    char t, d;
    cin >> t >> d;
    if (d == 'R') {
      for (int j = al[t - 'A'].size() - 1; j >= 0; j--) {
        if (al[t - 'A'][j] == n - 1) {
          ans[n - 1] = 0;
          continue;
        }
        ans[al[t - 'A'][j] + 1] += ans[al[t - 'A'][j]];
        ans[al[t - 'A'][j]] = 0;
      }
    } else {
      for (int j : al[t - 'A']) {
        if (j == 0) {
          ans[j] = 0;
          continue;
        }
        ans[j - 1] += ans[j];
        ans[j] = 0;
      }
    }
  }
  int an = 0;
  for (int i = 0; i < int(n); i++) an += ans[i];
  cout << an << endl;
}
