#include <bits/stdc++.h>
constexpr int alphabets = 'Z' - 'A' + 1;
int main() {
  std::size_t n, q;
  std::string s;
  std::array<std::vector<std::size_t>, alphabets> classes = {{}};
  std::vector<std::size_t> counts;
  std::cin >> n >> q >> s;
  for (auto& clazz : classes) {
    clazz.reserve(n);
  }
  counts.resize(n, 1u);
  {
    std::size_t i = 0;
    for (char c : s) {
      classes[c - 'A'].emplace_back(i++);
    }
  }
  std::size_t dead = 0;
  std::size_t right_max = n - 1;
  for (std::size_t i = 0; i < q; ++i) {
    char c, lr;
    std::cin >> c >> lr;
    bool left = lr == 'L';
    for (std::size_t index : classes.at(c - 'A')) {
      int move_count = counts[index];
      counts[index] = 0;
      if (left && index >= 1) {
        counts[index - 1] += move_count;
      } else if (!left && index < right_max) {
        counts[index + 1] += move_count;
      } else {
        dead += move_count;
      }
    }
  }
  std::cout << n - dead << std::endl;
}
