#include <bits/stdc++.h>
using namespace std;
int n, q;
string s;
char a, b;
vector<pair<int, int> > v[30];
vector<pair<int, pair<int, int> > > tt;
int toint(char a) { return (int)a - 65; }
int main() {
  scanf("%d%d", &n, &q);
  cin >> s;
  int lastt = -1;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      lastt = 0;
    } else if (s[i] != s[i - 1]) {
      v[toint(s[i - 1])].push_back(make_pair(lastt, i - 1));
      lastt = i;
    }
    if (i == n - 1) {
      v[toint(s[i])].push_back(make_pair(lastt, i));
    }
  }
  int gone = 0;
  for (int i = 0; i < q; i++) {
    scanf(" %c %c", &a, &b);
    tt.clear();
    for (vector<pair<int, int> >::iterator it = v[toint(a)].begin();
         it != v[toint(a)].end(); it++) {
      if (b == 'L') {
        if (it->first == 0) {
          gone++;
          if (it->second == 0)
            continue;
          else
            tt.push_back(make_pair(toint(a), make_pair(0, it->second - 1)));
        } else {
          if (it->second == it->first) {
            tt.push_back(make_pair(toint(s[it->first - 1]),
                                   make_pair(it->first - 1, it->first - 1)));
          } else {
            tt.push_back(make_pair(toint(s[it->first - 1]),
                                   make_pair(it->first - 1, it->first - 1)));
            tt.push_back(make_pair(toint(s[it->first]),
                                   make_pair(it->first, it->second - 1)));
          }
        }
      } else {
        if (it->second == n - 1) {
          gone++;
          if (it->first == n - 1)
            continue;
          else
            tt.push_back(
                make_pair(toint(a), make_pair(it->first + 1, it->second)));
        } else {
          if (it->second == it->first) {
            tt.push_back(make_pair(toint(s[it->second + 1]),
                                   make_pair(it->second + 1, it->second + 1)));
          } else {
            tt.push_back(make_pair(toint(s[it->second + 1]),
                                   make_pair(it->second + 1, it->second + 1)));
            tt.push_back(make_pair(toint(s[it->second]),
                                   make_pair(it->first + 1, it->second)));
          }
        }
      }
    }
    v[toint(a)].clear();
    for (vector<pair<int, pair<int, int> > >::iterator it = tt.begin();
         it != tt.end(); it++) {
      v[it->first].push_back(it->second);
    }
    tt.clear();
  }
  printf("%d\n", n - gone);
}
