#include <bits/stdc++.h>
int main() {
  long long n, q;
  std::cin >> n >> q;
  std::string s;
  std::vector<int> tnum(n + 2, 1);
  std::vector<std::vector<int> > vecmap(27);
  std::map<char, int> cmap;
  std::cin >> s;
  for (int i = 0; i < n; i++) {
    int sxi = (int)s[i] - 65;
    vecmap[sxi].push_back(i + 1);
  }
  long long answer = n;
  for (int i = 0; i < q; i++) {
    char t, d;
    std::cin >> t >> d;
    int dnum = 0;
    if (d == 'L')
      dnum = -1;
    else
      dnum = 1;
    int vecnum = (int)t - 65;
    for (int j = 0; j < vecmap[vecnum].size(); j++) {
      if (tnum[vecmap[vecnum][j]] != 0) {
        if ((vecmap[vecnum][j] + dnum == 0) ||
            vecmap[vecnum][j] + dnum == n + 1) {
          answer -= tnum[vecmap[vecnum][j]];
          tnum[vecmap[vecnum][j]] = 0;
        } else {
          tnum[vecmap[vecnum][j] + dnum] += tnum[vecmap[vecnum][j]];
          tnum[vecmap[vecnum][j]] = 0;
        }
      }
    }
  }
  std::cout << answer << std::endl;
  return 0;
}
