#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = std::vector<T>;
template <class T>
using vvec = vec<vec<T>>;
constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }
class Golems {
 public:
  Golems(int n, std::string s) : n(n), v(n + 2), parents(n + 2), s(s) {
    for (int i = 0; i < n; ++i) {
      c2index.emplace(s[i], i + 1);
      v[i + 1] = 1;
    }
    int a = 0;
  }
  void move(char c, int dir) {
    auto range = c2index.equal_range(c);
    for (auto it = range.first; it != range.second; ++it) {
      auto index = it->second;
      v[index + dir] += v[index];
      v[index] = 0;
    }
  }
  int remain() { return n - v.front() - v.back(); }

 private:
  int n;
  vec<int> v;
  vec<int> parents;
  std::string s;
  std::multimap<char, int> c2index;
  int root() {}
};
int main() {
  using namespace std;
  int n, q;
  string s;
  cin >> n >> q >> s;
  Golems g{n, s};
  for (int i = 0; i < q; ++i) {
    char c, d;
    cin >> c >> d;
    auto dir = d == 'R' ? 1 : -1;
    g.move(c, dir);
  }
  cout << g.remain() << endl;
  return 0;
}
