#include <bits/stdc++.h>
int main() {
  int N, Q;
  std::cin >> N >> Q;
  std::string s;
  std::cin >> s;
  std::unordered_map<char, std::vector<int>> map;
  for (int i = 0; i < s.length(); i++) {
    const char c = s.at(i);
    map[c].emplace_back(i);
  }
  std::vector<int> num(N, 1);
  for (int i = 0; i < Q; i++) {
    char t, d;
    std::cin >> t >> d;
    const int dd = (d == 'L' ? -1 : 1);
    for (const int &j : map[t]) {
      if (num[j] > 0) {
        const int to = j + dd;
        if (0 <= to && to < N) {
          num[to] += num[j];
        }
        num[j] = 0;
      }
    }
  }
  int result = 0;
  for (const int &n : num) {
    result += n;
  }
  std::cout << result << std::endl;
  return 0;
}
