#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n, q, ans, x;
  char z;
  cin >> n >> q;
  ans = n;
  vector<int> v(n, 1);
  vector<vector<int>> u(26, vector<int>());
  for (int i = 0; i < n; i++) {
    cin >> z;
    x = z - 'A';
    u.at(x).push_back(i);
  }
  for (int j = 0; j < q; j++) {
    char a, b;
    cin >> a >> b;
    int y;
    y = a - 'A';
    if (b == 'L') {
      for (int j = 0; j < u.at(y).size(); j++) {
        if (u.at(y).at(j) == 0) {
          ans -= v.at(0);
          v.at(0) = 0;
        } else {
          v.at(u.at(y).at(j) - 1) += v.at(u.at(y).at(j));
          v.at(u.at(y).at(j)) = 0;
        }
      }
    } else {
      for (int j = 0; j < u.at(y).size(); j++) {
        if (u.at(y).at(j) == n - 1) {
          ans -= v.at(n - 1);
          v.at(n - 1) = 0;
        } else {
          v.at(u.at(y).at(j) + 1) += v.at(u.at(y).at(j));
          v.at(u.at(y).at(j)) = 0;
        }
      }
    }
  }
  cout << ans << endl;
}
