#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int N, Q;
vector<int> M;
vector<vector<int> > P;
vector<int> F;
signed main() {
  cin >> N >> Q;
  M = vector<int>(N, 1);
  P = vector<vector<int> >(26);
  F = vector<int>(26, 0);
  for (int i = 0; i < 26; ++i) {
    P[i] = vector<int>(0);
  }
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); ++i) {
    F[s[i] - 'A'] = 1;
    P[s[i] - 'A'].push_back(i);
  }
  for (int i = 0; i < Q; ++i) {
    char t, d;
    cin >> t >> d;
    int idx = (int)(t - 'A');
    if (F[idx] == 0) continue;
    F[idx] = 0;
    for (int j = 0; j < P[idx].size(); ++j) {
      if (d == 'L') {
        if (P[idx][j] != 0) {
          F[s[P[idx][j] - 1] - 'A'] = 1;
          M[P[idx][j] - 1] += M[P[idx][j]];
        }
      } else {
        if (P[idx][j] != N - 1) {
          F[s[P[idx][j] + 1] - 'A'] = 1;
          M[P[idx][j] + 1] += M[P[idx][j]];
        }
      }
      M[P[idx][j]] = 0;
    }
  }
  long long ans = accumulate((M).begin(), (M).end(), 0LL);
  cout << ans << endl;
  return 0;
}
