#include <bits/stdc++.h>
int main(void) {
  int64_t N, Q;
  std::string s;
  std::cin >> N >> Q >> s;
  std::vector<int64_t> boxes(N, 1);
  std::map<char, std::vector<int64_t>> map;
  for (uint64_t i = 0; i < s.size(); ++i) {
    auto &c = s.at(i);
    auto &list = map[c];
    list.push_back(i);
  }
  int64_t num = N;
  for (int64_t i = 0; i < Q; ++i) {
    char t, d;
    std::cin >> t >> d;
    auto &list = map[t];
    if (d == 'L') {
      for (uint64_t j = 0; j < list.size(); ++j) {
        auto idx = list.at(j);
        if (idx == 0) {
          num -= boxes[idx];
        } else {
          boxes[idx - 1] += boxes[idx];
        }
        boxes[idx] = 0;
      }
    } else {
      for (int64_t j = list.size() - 1; j >= 0; --j) {
        auto idx = list.at(j);
        if (idx == N - 1) {
          num -= boxes[idx];
        } else {
          boxes[idx + 1] += boxes[idx];
        }
        boxes[idx] = 0;
      }
    }
  }
  std::cout << num << std::endl;
  return 0;
}
