#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<int> strMap[100];
  int golems[n];
  for (int i = 0; i < n; i++) {
    strMap[(int)s[i]].push_back(i);
    golems[i] = 1;
  }
  int nSum = 0;
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'L')
      for (int j : strMap[(int)t]) {
        if (j > 0)
          golems[j - 1] += golems[j];
        else
          nSum += golems[j];
        golems[j] = 0;
      }
    else
      for (int j : strMap[(int)t]) {
        if (j < n - 1)
          golems[j + 1] += golems[j];
        else
          nSum += golems[j];
        golems[j] = 0;
      }
  }
  cout << (n - nSum) << endl;
  return 0;
}
