#include <bits/stdc++.h>
int main() {
  int n, q;
  std::string s;
  std::cin >> n >> q;
  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;
  for (int i{}; i < q; ++i) {
    char t, d;
    std::cin >> t >> d;
    for (auto e : v[t - 'A']) {
      auto lr = d == 'L';
      auto index = e + (lr ? -1 : 1);
      tab[index] += tab[e];
      tab[e] = 0;
    }
  }
  std::cout << n - (tab.back() + tab.front()) << "\n";
}
