#include <bits/stdc++.h>
int main() {
  long n, q;
  std::cin >> n >> q;
  std::string s;
  std::cin >> s;
  std::vector<char> t(q);
  std::vector<char> d(q);
  for (long i = 0; i < q; ++i) std::cin >> t[i] >> d[i];
  std::vector<std::vector<long>> massMap(26);
  std::vector<long> golemArr(n);
  for (long i = 0; i < n; ++i) {
    massMap[s[i] - 'A'].push_back(i);
    golemArr[i] = 1;
  }
  long ans = n;
  for (long i = 0; i < q; ++i) {
    std::vector<long> newGolemArr(n);
    auto massList = massMap[t[i] - 'A'];
    if (d[i] == 'L') {
      for (unsigned long m = 0; m < massList.size(); ++m) {
        if (massList[m] == 0) {
          ans -= golemArr[0];
          golemArr[0] = 0;
        } else {
          golemArr[massList[m] - 1] += golemArr[massList[m]];
          golemArr[massList[m]] = 0;
        }
      }
    } else {
      for (long m = massList.size() - 1; m >= 0; --m) {
        if (massList[m] == n - 1) {
          ans -= golemArr[n - 1];
          golemArr[n - 1] = 0;
        } else {
          golemArr[massList[m] + 1] += golemArr[massList[m]];
          golemArr[massList[m]] = 0;
        }
      }
    }
  }
  std::cout << ans << std::endl;
  return 0;
}
