#include <bits/stdc++.h>
std::array<std::vector<long>, 26> map;
int main(void) {
  size_t n, q;
  std::string s;
  std::cin >> n >> q >> s;
  for (size_t i = 0; i < n; i++) {
    char c = s[i] - 'A';
    map[c].push_back(i);
  }
  std::vector<char> t(q), d(q);
  for (size_t i = 0; i < q; i++) {
    std::cin >> t[i] >> d[i];
  }
  long remove = 0;
  std::vector<long> area(n, 1L);
  for (size_t i = 0; i < q; i++) {
    char c = t[i] - 'A';
    const auto& m = map[c];
    size_t len = m.size();
    if (d[i] == 'L') {
      for (size_t j = 0; j < len; j++) {
        const auto p = m[j];
        if (p == 0) {
          remove += area[0];
          area[p] = 0;
        } else {
          area[p - 1] += area[p];
          area[p] = 0;
        }
      }
    } else {
      for (ssize_t j = len - 1; j >= 0; j--) {
        const auto p = m[j];
        if (p == n - 1) {
          remove += area[n - 1];
          area[p] = 0;
        } else {
          area[p + 1] += area[p];
          area[p] = 0;
        }
      }
    }
  }
  std::cout << n - remove << std::endl;
  return 0;
}
