#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  vector<vector<int>> place(26);
  for (int x = 0; x < (N); x++) {
    (place.at(S.at(x) - 'A')).push_back((x));
  }
  int field[N];
  for (int x = 0; x < (N); x++) {
    field[x] = 1;
  }
  for (int x = 0; x < (Q); x++) {
    char t, d;
    cin >> t >> d;
    for (int y = 0; y < (place.at(t - 'A').size()); y++) {
      if (d == 'R') {
        if (place.at(t - 'A').at(y) != N - 1) {
          field[place.at(t - 'A').at(y) + 1] += field[place.at(t - 'A').at(y)];
        }
        field[place.at(t - 'A').at(y)] = 0;
      } else {
        if (place.at(t - 'A').at(y) != 0) {
          field[place.at(t - 'A').at(y) - 1] += field[place.at(t - 'A').at(y)];
        }
        field[place.at(t - 'A').at(y)] = 0;
      }
    }
  }
  int ans = 0;
  for (int x = 0; x < (N); x++) {
    ans += field[x];
  }
  cout << ans << endl;
}
