#include <bits/stdc++.h>
using namespace std;
int S[100010] = {0};
int main() {
  vector<int> table[26];
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  for (int i = 0; i < N; i++) {
    S[i] = 1;
    table[s[i] - 'A'].push_back(i);
  }
  char buff[10];
  cin.getline(buff, sizeof(buff));
  for (int i = 0; i < Q; i++) {
    cin.getline(buff, sizeof(buff));
    int ti = buff[0] - 'A';
    for (int j = 0; j < table[ti].size(); j++) {
      int Si = table[ti][j];
      if (Si == 0 && buff[2] == 'L') {
        S[Si] = 0;
      } else if (Si == N - 1 && buff[2] == 'R') {
        S[Si] = 0;
      } else {
        if (buff[2] == 'L') {
          S[Si - 1] += S[Si];
          S[Si] = 0;
        } else {
          S[Si + 1] += S[Si];
          S[Si] = 0;
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++)
    if (S[i]) ans += S[i];
  cout << ans << endl;
  return 0;
}
