#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 5;
bitset<MAX> b[26], cur;
pair<int, int> que[MAX];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n, q;
  string s;
  cin >> n >> q >> s;
  for (int i = 0; i < n; ++i) b[s[i] - 'A'][i + 1] = 1;
  cur[0] = cur[n + 1] = 1;
  for (int i = 0; i < q; ++i) {
    static char c, d;
    cin >> c >> d;
    que[q - i - 1] = {c - 'A', d == 'L' ? -1 : 1};
  }
  for (int i = 0; i < q; ++i) {
    if (que[i].second == -1)
      cur |= (cur << 1) & b[que[i].first];
    else
      cur |= (cur >> 1) & b[que[i].first];
  }
  int ans = n;
  for (int i = 1; i <= n; ++i) ans -= cur[i];
  cout << ans;
}
