#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  map<char, std::pair<int, int> > thresholds;
  map<char, int> displacement;
  for (int i = 0; i < n; ++i) {
    thresholds[s[i]] = std::pair<int, int>(0, 0);
    displacement[s[i]] = 0;
  }
  for (int i = 0; i < q; ++i) {
    char c, dir;
    cin >> c >> dir;
    if (dir == 'L') {
      displacement[c]--;
      thresholds[c].first = min(thresholds[c].first, displacement[c]);
    } else {
      displacement[c]++;
      thresholds[c].second = max(thresholds[c].first, displacement[c]);
    }
  }
  int total = n;
  for (int i = 0; i < n; ++i) {
    auto c = s[i];
    int leftmost = i + thresholds[c].first;
    int rightmost = i + thresholds[c].second;
    if (i >= 0 && i < n) {
    } else {
      total--;
    }
  }
  cout << total;
}
