#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  vector<int> golems(n, 1);
  multimap<char, int> map;
  for (int i = 0; i < n; i++) {
    char c;
    cin >> c;
    map.emplace(c, i);
  }
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    auto it = map.lower_bound(t);
    auto last = map.upper_bound(t);
    if (d == 'L') {
      for (it; it != last; it++) {
        int index = (*it).second;
        if (index != 0) golems[index - 1] += golems[index];
        golems[index] = 0;
      }
    }
    if (d == 'R') {
      vector<pair<int, int>> changes;
      for (it; it != last; it++) {
        int index = (*it).second;
        if (index != n - 1) {
          changes.emplace_back(index + 1, golems[index]);
        }
        golems[index] = 0;
      }
      for (auto it2 = changes.begin(); it2 != changes.end(); it2++) {
        golems[(*it2).first] += (*it2).second;
      }
    }
  }
  int ans = accumulate(golems.begin(), golems.end(), 0);
  cout << ans << endl;
}
