#include <bits/stdc++.h>
int main() {
  uint64_t N, Q;
  std::cin >> N >> Q;
  std::string s;
  std::cin >> s;
  std::array<std::set<uint64_t>, 26> a;
  std::vector<std::set<uint64_t>> v(N, std::set<uint64_t>());
  for (uint64_t n = 0; n < N; ++n) {
    a[s[n] - 'A'].emplace(n);
    v[n].emplace(n);
  }
  for (uint64_t q = 0; q < Q; ++q) {
    char t, d;
    std::cin >> t >> d;
    if (d == 'L') {
      for (auto itr = a[t - 'A'].begin(); itr != a[t - 'A'].end(); ++itr) {
        uint64_t n = *itr;
        if (v[n].size() == 0) {
          continue;
        }
        if (n == 0) {
          v[0] = std::set<uint64_t>();
        } else {
          if (v[n - 1].size() == 0) {
            v[n - 1] = v[n];
          } else {
            std::set_union(v[n - 1].begin(), v[n - 1].end(), v[n - 0].begin(),
                           v[n - 0].end(),
                           std::inserter(v[n - 1], v[n - 1].begin()));
          }
          v[n - 0] = std::set<uint64_t>();
        }
      }
    } else {
      for (auto itr = a[t - 'A'].rbegin(); itr != a[t - 'A'].rend(); ++itr) {
        uint64_t n = *itr;
        if (v[n].size() == 0) {
          continue;
        }
        if (n == N - 1) {
          v[N - 1] = std::set<uint64_t>();
        } else {
          if (v[n + 1].size() == 0) {
            v[n + 1] = v[n];
          } else {
            std::set_union(v[n + 1].begin(), v[n + 1].end(), v[n + 0].begin(),
                           v[n + 0].end(),
                           std::inserter(v[n + 1], v[n + 1].begin()));
          }
          v[n + 0] = std::set<uint64_t>();
        }
      }
    }
  }
  uint64_t count = 0;
  for (uint64_t n = 0; n < N; ++n) {
    count += v[n].size();
  }
  std::cout << count << std::endl;
  return 0;
}
