#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  string S;
  cin >> N >> Q >> S;
  vector<int> v(N, 1);
  vector<vector<char>> a(Q, vector<char>(2));
  for (int i = 0; i < Q; i++) {
    cin >> a.at(i).at(0) >> a.at(i).at(1);
  }
  int ans = N;
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < N; j++) {
      if (a.at(i).at(0) == S.at(j)) {
        if (a.at(i).at(1) == 'R') {
          if (a.at(i).at(0) == S.at(N - 1)) {
            ans -= v.at(N - 1);
            v.at(N - 1) = 0;
          } else {
            v.at(j - 1) += v.at(j);
            v.at(j) = 0;
          }
        } else {
          if (a.at(i).at(0) == S.at(0)) {
            ans -= v.at(0);
            v.at(0) = 0;
          } else {
            v.at(j - 1) += v.at(j);
            v.at(j) = 0;
          }
        }
      }
    }
  }
  cout << ans << endl;
}
