#include <bits/stdc++.h>
int main() {
  int n, q;
  std::string s;
  std::cin.tie(nullptr);
  std::cin.sync_with_stdio(false);
  std::cin >> n >> q;
  s.reserve(n);
  std::cin >> s;
  std::vector<std::vector<int>> v(26, std::vector<int>{});
  for (int i{}; i < n; ++i) {
    v[s[i] - 'A'].emplace_back(i + 1);
  }
  std::vector<int> tab(n + 2, 1);
  tab.front() = tab.back() = 0;
  char bt = 0;
  for (int i{}; i < q; ++i) {
    char t, d;
    std::cin >> t >> d;
    if (bt == t) continue;
    if (v[t - 'A'].empty()) continue;
    auto dis = d == 'L' ? -1 : 1;
    for (auto e : v[t - 'A']) {
      if (tab[e] == 0) continue;
      tab[e + dis] += tab[e];
      tab[e] = 0;
    }
    bt = t;
  }
  std::cout << n - (tab.back() + tab.front()) << "\n";
}
