#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  string S;
  cin >> N >> Q >> S;
  int f_num[N];
  char f_ch[N];
  for (int i = 0; i < N; i++) {
    f_num[i] = 1;
    f_ch[i] = S[i];
  }
  vector<char> w_sta(Q);
  vector<char> w_ang(Q);
  for (int i = 0; i < Q; i++) {
    cin >> w_sta[i] >> w_ang[i];
  }
  int ans = 0;
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < N; j++) {
      if (f_ch[j] == w_sta[i]) {
        switch (w_ang[i]) {
          case 'L':
            if (j == 0) {
              ans += f_num[j];
              f_num[j] = 0;
              break;
            } else {
              f_num[j - 1] += f_num[j];
              f_num[j] = 0;
              break;
            }
          case 'R':
            if (j == N - 1) {
              ans += f_num[j];
              f_num[j] = 0;
              break;
            } else {
              f_num[j + 1] += f_num[j];
              f_num[j] = 0;
              break;
            }
        }
      }
    }
  }
  cout << N - ans << endl;
  return 0;
}
