#include <bits/stdc++.h>
using namespace std;
int static fast = []() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  return 0;
}();
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  char ch, dir;
  vector<vector<int>> pos(26);
  for (int i = 0; i < s.length(); i++) {
    pos[s[i] - 'A'].push_back(i + 1);
  }
  vector<int> sq(N + 1, 1);
  char pre;
  for (int i = 0; i < Q; i++) {
    cin >> ch >> dir;
    if (ch == pre || pos[ch - 'A'].size() == 0) continue;
    for (int p : pos[ch - 'A']) {
      int mv = sq[p];
      if (dir == 'L') {
        sq[p] -= mv;
        sq[p - 1] += mv;
      } else {
        sq[p] -= mv;
        if (p + 1 <= N) sq[p + 1] += mv;
      }
    }
    pre = ch;
  }
  int ans = 0;
  for (int i = 1; i <= N; i++) {
    ans += sq[i];
  }
  cout << ans << endl;
  return 0;
}
