#include <bits/stdc++.h>
constexpr int kMod = 1000000007;
int main() {
  int N, Q;
  std::cin >> N >> Q;
  std::string S;
  std::cin >> S;
  std::map<char, std::vector<int>> m;
  for (int i = 0; i < N; ++i) {
    m[S[i]].push_back(i + 1);
  }
  std::vector<int> monster(N + 2, 1);
  monster[0] = 0;
  for (int i = 0; i < Q; ++i) {
    char t, d;
    std::cin >> t >> d;
    if (d == 'L') {
      for (auto it = m[t].begin(); it != m[t].end(); ++it) {
        int n = *it;
        monster[n - 1] += monster[n];
        monster[n] = 0;
      }
    }
    if (d == 'R') {
      for (auto it = m[t].rbegin(); it != m[t].rend(); ++it) {
        int n = *it;
        monster[n + 1] += monster[n];
        monster[n] = 0;
      }
    }
    monster[0] = 0;
    monster[N + 1] = 0;
  }
  int cnt = 0;
  for (int v : monster) cnt += v;
  std::cout << cnt << std::endl;
}
