#include <bits/stdc++.h>
using namespace std;
template <typename T>
using reversed_priority_queue =
    std::priority_queue<T, std::vector<T>, std::greater<T>>;
long long int N, Q;
string s;
map<char, vector<long long int>> r, l;
set<long long int> del;
vector<pair<char, char>> qs;
signed main() {
  cin >> N >> Q >> s;
  l[s[0]].push_back(0);
  r[s[N - 1]].push_back(N - 1);
  for (long long int i = static_cast<long long int>(0);
       i < static_cast<long long int>(Q); ++i) {
    char c, dir;
    cin >> c >> dir;
    qs.emplace_back(c, dir);
  }
  reverse(begin(qs), end(qs));
  for (auto q : qs) {
    char c = q.first, dir = q.second;
    vector<long long int> v;
    if (dir == 'R') {
      v = r[c];
      r[c].clear();
    } else {
      v = l[c];
      l[c].clear();
    }
    for (auto i : v) {
      del.insert(i);
    }
    for (auto i : v) {
      if (i - 1 >= 0 && del.find(i - 1) == del.end()) {
        r[s[i - 1]].push_back(i - 1);
      }
      if (i + 1 < N && del.find(i + 1) == del.end()) {
        l[s[i + 1]].push_back(i + 1);
      }
    }
  }
  cout << N - del.size() << endl;
  return 0;
}
