#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  string S;
  cin >> S;
  string str;
  str.push_back('0');
  str += S;
  int arr[n + 2];
  for (int i = 1; i <= n; i++) arr[i] = 1;
  map<char, vector<int> > Hash;
  for (int i = 1; i <= n; i++) {
    Hash[str[i]].push_back(i);
  }
  while (q--) {
    char ch, dir;
    cin >> ch >> dir;
    if (dir == 'L') {
      for (int i = 0; i < Hash[ch].size(); i++) {
        arr[Hash[ch][i] - 1] += arr[Hash[ch][i]];
        arr[Hash[ch][i]] = 0;
      }
    } else if (dir == 'R') {
      for (int i = Hash[ch].size() - 1; i >= 0; i--) {
        arr[Hash[ch][i] + 1] += arr[Hash[ch][i]];
        arr[Hash[ch][i]] = 0;
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += arr[i];
  }
  cout << ans << endl;
  return 0;
}
