#include <bits/stdc++.h>
int main() {
  int N, Q;
  std::cin >> N >> Q;
  std::string S;
  std::cin >> S;
  int g[(2 * 100000)];
  std::vector<int> Map[27];
  for (int i = 0; i < N; ++i) {
    g[i] = 1;
    Map[S[i] - 'A'].push_back(i);
  }
  char t, d;
  int temp;
  int ans = N;
  for (int i = 0; i < Q; i++) {
    std::cin >> t >> d;
    if (Map[t - 'A'].size() != 0) {
      for (auto &&e : Map[t - 'A']) {
        if (d == 'R') {
          temp = g[e];
          g[e] = 0;
          g[e + 1] += temp;
          if (e + 1 == N) ans -= temp;
        } else if (d == 'L') {
          temp = g[e];
          g[e] = 0;
          if (e == 0)
            ans -= temp;
          else
            g[e - 1] += temp;
        }
      }
    }
  }
  std::cout << ans << std::endl;
}
