#include <bits/stdc++.h>
using namespace std;
void disp(vector<int> v) {
  for (int i : v) {
    cout << i << " ";
  }
  cout << endl;
}
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<char> T;
  vector<char> D;
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    T.push_back(t);
    D.push_back(d);
  }
  vector<int> G(N, 1);
  vector<int> G_temp(N, 1);
  int result = N;
  for (int i = 0; i < Q; i++) {
    char t = T[i];
    char d = D[i];
    if (d == 'L') {
      int find_index = 0;
      while (s.find(t, find_index) != -1) {
        int j = s.find(t, find_index);
        find_index = j + 1;
        if (find_index > N - 1) {
          break;
        }
        int temp = G[j];
        G[j] = 0;
        if (j == 0) {
          result -= temp;
        } else {
          G[j - 1] += temp;
        }
      }
    } else if (d == 'R') {
      int find_index = s.size() - 1;
      while (s.rfind(t, find_index) != -1) {
        int j = s.rfind(t, find_index);
        find_index = j - 1;
        if (find_index < 0) {
          break;
        }
        int temp = G[j];
        G[j] = 0;
        if (j == N - 1) {
          result -= temp;
        } else {
          G[j + 1] += temp;
        }
      }
    } else {
      cout << "error1" << endl;
    }
  }
  cout << result << endl;
  return 0;
}
