#include <bits/stdc++.h>
using namespace std;
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  long long n;
  cin >> n;
  ;
  long long m;
  cin >> m;
  ;
  ;
  string st;
  cin >> st;
  vector<pair<char, long long>> data(m);
  for (long long i = 0; i < m; i++) {
    string a;
    cin >> a;
    data[i].first = a[0];
    string b;
    cin >> b;
    if (b == "R") {
      data[i].second = 0;
    } else {
      data[i].second = 1;
    }
  }
  reverse((data).begin(), (data).end());
  vector<long long> ans(n, 0);
  long long p1 = -1, pn = n;
  for (long long i = 0; i < data.size(); i++) {
    if (data[i].second) {
      if (((0) <= (p1 + 1) && (p1 + 1) < (n)) && st[p1 + 1] == data[i].first) {
        p1++;
        ans[p1] = 1;
      }
      if (((0) <= (pn + 1) && (pn + 1) < (n)) && st[pn + 1] == data[i].first) {
        pn++;
        ans[pn] = 1;
      }
    } else {
      if (((0) <= (p1) && (p1) < (n)) && st[p1] == data[i].first) {
        p1--;
        ans[p1] = 1;
      }
      if (((0) <= (pn) && (pn) < (n)) && st[pn] == data[i].first) {
        pn--;
        ans[pn] = 1;
      }
    }
  }
  long long yui = 0;
  for (long long i = 0; i < n; i++) {
    yui += ans[i];
  }
  std::cout << n - yui << std::endl;
  return 0;
}
