#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q, i, j, ans = 0;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> g(n + 2);
  for (i = 1; i < n + 1; i++) {
    g[i] = 1;
    ans++;
  }
  char t, d;
  int move;
  for (i = 0; i < q; i++) {
    cin >> t >> d;
    move = d == 'R' ? 1 : -1;
    if (move == -1) {
      for (j = 0; j < n; j++) {
        if (s[j] == t) {
          g[j] += g[j + 1];
          g[j + 1] = 0;
        }
      }
    } else {
      for (j = n - 1; j >= 0; j--) {
        if (s[j] == t) {
          g[j + 2] += g[j + 1];
          g[j + 1] = 0;
        }
      }
    }
  }
  cout << ans - g[0] - g[n + 1];
}
