#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<char> td;
  for (int i = 0; i < 2 * Q; i++) {
    char tmp;
    cin >> tmp;
    td.push_back(tmp);
  }
  vector<vector<int>> m(26);
  vector<int> g(N, 1);
  for (int i = 0; i < N; i++) {
    m[s[i] - 'A'].push_back(i);
  }
  for (int q = 0; q < Q; q++) {
    char t = td[2 * q];
    char d = td[2 * q + 1];
    if (d == 'L') {
      for (auto i : m[t - 'A']) {
        if (i == 0)
          g[0] = 0;
        else {
          g[i - 1] += g[i];
          g[i] = 0;
        }
      }
    } else {
      reverse(m[t - 'A'].begin(), m[t - 'A'].end());
      for (auto i : m[t - 'A']) {
        if (i == N - 1)
          g[N - 1] = 0;
        else {
          g[i + 1] += g[i];
          g[i] = 0;
        }
      }
      reverse(m[t - 'A'].begin(), m[t - 'A'].end());
    }
  }
  int ans = accumulate(g.begin(), g.end(), 0);
  cout << ans << endl;
  return 0;
}
