#include <bits/stdc++.h>
using namespace std;
int N, Q;
string s;
set<int> dead;
vector<pair<char, char> > qs;
int f(int cur) {
  for (int i = Q - 1; i >= 0; i--) {
    char c = qs[i].first;
    int d = qs[i].second == 'L' ? -1 : 1;
    if (s[cur - d] == c) {
      cur -= d;
      dead.insert(cur);
    }
  }
}
int main() {
  cin >> N >> Q;
  cin >> s;
  s = "#@" + s + "$#";
  for (int i = 0; i < Q; i++) {
    char a, b;
    cin >> a >> b;
    qs.push_back({a, b});
  }
  f(1);
  f(s.size() - 2);
  int ans = 0;
  for (int i = 2; i < s.size() - 2; i++) {
    if (!dead.count(i)) ans++;
  }
  cout << ans << endl;
}
