#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<vector<int> *> places(26);
  for (int i = 0; i < 26; ++i) {
    places[i] = new vector<int>();
  }
  for (int i = 0; i < (int)s.length(); ++i) {
    int place = (int)(s[i] - 'A');
    places[place]->push_back(i);
  }
  vector<char> &t = *(new vector<char>(q, 1));
  vector<int> &d = *(new vector<int>(q, 1));
  for (int i = 0; i < q; ++i) {
    char c;
    cin >> c;
    t[i] = c;
    cin >> c;
    if (c == 'L') {
      d[i] = -1;
    } else {
      d[i] = 1;
    }
  }
  vector<int> &g = *(new vector<int>(n, 1));
  int alive = n;
  for (int i = 0; i < q; ++i) {
    int index = (int)(t[i] - 'A');
    if (d[i] == -1) {
      for (int j = 0; j < (int)places[index]->size(); ++j) {
        int place = places[index]->at(j);
        if (place > 0) {
          g[place - 1] += g[place];
        } else {
          alive -= g[place];
        }
        g[place] = 0;
      }
    } else if (d[i] == 1) {
      for (int j = places[index]->size() - 1; j >= 0; --j) {
        int place = places[index]->at(j);
        if (place < n - 1) {
          g[place + 1] += g[place];
        } else {
          alive -= g[place];
        }
        g[place] = 0;
      }
    }
  }
  cout << alive << endl;
  return 0;
}
