#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, q;
  cin >> n >> q;
  long long b = n;
  vector<vector<long long>> a(n, vector<long long>(n));
  string s;
  cin >> s;
  for (long long i = 0; i < n; i++) {
    a.at(0).at(i) = s.at(i) - 65;
    a.at(1).at(i) = 1;
  }
  vector<char> t(q), d(q);
  for (long long i = 0; i < q; i++) {
    cin >> t.at(i) >> d.at(i);
    if (d.at(i) == 'L') {
      for (long long j = 0; j < n; j++) {
        if (a.at(0).at(j) == t.at(i) - 65) {
          long long f = a.at(1).at(j);
          if (j == 0 && a.at(1).at(j) != 0) {
            b -= f;
            a.at(1).at(j) = 0;
          } else {
            a.at(1).at(j - 1) += f;
            a.at(1).at(j) -= f;
          }
        }
      }
    } else if (d.at(i) == 'R') {
      for (long long j = 0; j < n; j++) {
        if (a.at(0).at(j) == t.at(i) - 65) {
          long long f = a.at(1).at(j);
          if (j == n - 1 && a.at(1).at(j) != 0) {
            b -= f;
            a.at(1).at(j) = 0;
          } else {
            a.at(1).at(j + 1) += f;
            a.at(1).at(j) -= f;
          }
        }
      }
    }
  }
  cout << b << endl;
}
