#include <bits/stdc++.h>
using namespace std;
char t[200000];
char d[200000];
vector<int> zoku[26];
int dp[200000];
int main() {
  string s;
  int n, q;
  cin >> n >> q;
  cin >> s;
  for (int i = 0; i < q; i++) cin >> t[i] >> d[i];
  for (int i = 0; i < n; i++) zoku[s[i] - 'A'].push_back(i);
  fill(dp, dp + n, 1);
  int fall = 0;
  for (int i = 0; i < q; i++) {
    int tmp = t[i] - 'A';
    if (d[i] == 'L') {
      for (int j = 0; j < zoku[tmp].size(); j++) {
        if (zoku[tmp][j] == 0)
          fall += dp[zoku[tmp][j]];
        else
          dp[zoku[tmp][j] - 1] += dp[zoku[tmp][j]];
        dp[zoku[tmp][j]] = 0;
      }
    } else {
      for (int j = zoku[tmp].size() - 1; j > -1; j--) {
        if (zoku[tmp][j] == n - 1)
          fall += dp[zoku[tmp][j]];
        else
          dp[zoku[tmp][j] + 1] += dp[zoku[tmp][j]];
        dp[zoku[tmp][j]] = 0;
      }
    }
  }
  cout << n - fall << endl;
  return 0;
}
