#include <bits/stdc++.h>
constexpr int MAX = 2 * (int)1e5 + 10;
constexpr int d[2] = {-1, 1};
int n, q;
std::string str;
char ch[MAX];
char dir[MAX];
bool copy[MAX];
bool dat[MAX];
std::map<char, std::vector<int>> map;
int main() {
  std::cin >> n >> q;
  std::cin >> str;
  for (int i = 0; i < str.size(); ++i) map[str[i]].emplace_back(i + 1);
  for (int i = 0; i < q; ++i) std::cin >> ch[i] >> dir[i];
  dat[0] = dat[n + 1] = true;
  for (int i = q - 1; i >= 0; --i) {
    int dd = d[dir[i] == 'R'];
    std::memset(copy, 0, sizeof(copy));
    for (int j = 0; j < map[ch[i]].size(); ++j)
      copy[map[ch[i]][j]] = dat[map[ch[i]][j] + dd];
    for (int j = 0; j < map[ch[i]].size(); ++j)
      dat[map[ch[i]][j]] = copy[map[ch[i]][j]];
  }
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    if (dat[i]) ++cnt;
  }
  std::cout << n - cnt << std::endl;
  return 0;
}
