#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, q, u = 0;
  char t, d;
  string s;
  cin >> n >> q >> s;
  long long x[n + 2];
  s = "a" + s + "a";
  vector<pair<long long, long long>> k1, k2;
  k1.push_back(make_pair(0, 0));
  for (long long i = 0; i < n; i++) k1.push_back(make_pair(i + 1, 1));
  k1.push_back(make_pair(n + 1, 0));
  cerr << s << endl;
  sort(k1.begin(), k1.end());
  for (long long i = 0; i < k1.size(); i++)
    cerr << k1[i].first << ' ' << k1[i].second << endl;
  for (long long i = 0; i < q; i++) {
    cin >> t >> d;
    u = 0;
    if (d != 'L') {
      for (long long j = 0; j < k1.size(); j++) {
        if (s[k1[j].first] == t) {
          if (k1[j].first + 1 != k1[j + 1].first)
            k2.push_back(make_pair(k1[j].first + 1, k1[j].second));
          else {
            if (s[k1[j + 1].first] != t) {
              k2.push_back(
                  make_pair(k1[j + 1].first, k1[j].second + k1[j + 1].second));
              u = 1;
            } else
              k2.push_back(make_pair(k1[j + 1].first, k1[j].second));
          }
        } else {
          if (u == 0)
            k2.push_back(make_pair(k1[j].first, k1[j].second));
          else
            u = 0;
        }
      }
      k1 = move(k2);
    } else {
      for (long long j = k1.size() - 1; j >= 0; j--) {
        if (s[k1[j].first] == t) {
          if (k1[j].first - 1 != k1[j - 1].first)
            k2.push_back(make_pair(k1[j].first - 1, k1[j].second));
          else {
            if (s[k1[j - 1].first] != t) {
              k2.push_back(
                  make_pair(k1[j - 1].first, k1[j].second + k1[j - 1].second));
              u = 1;
            } else
              k2.push_back(make_pair(k1[j - 1].first, k1[j].second));
          }
        } else {
          if (u == 0)
            k2.push_back(make_pair(k1[j].first, k1[j].second));
          else
            u = 0;
        }
      }
      k1 = move(k2);
      sort(k1.begin(), k1.end());
    }
    for (long long i = 0; i < k1.size(); i++)
      cerr << k1[i].first << ' ' << k1[i].second << endl;
  }
  for (long long i = 0; i < k1.size(); i++)
    cerr << k1[i].first << ' ' << k1[i].second << endl;
  cout << n - k1[0].second - k1[k1.size() - 1].second;
  return 0;
}
