#include <bits/stdc++.h>
using namespace std;
int N, Q;
string s;
unordered_map<char, vector<int>> mp;
vector<int> golems;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> Q;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    mp[s[i]].push_back(i);
  }
  golems.resize(N, 1);
  for (int q = 0; q < Q; q++) {
    char t, d;
    cin >> t >> d;
    vector<int> vec = mp[t];
    if (d == 'L') {
      for (int i = 0; i < vec.size(); i++) {
        int pos = vec[i];
        if (pos == 0) {
          golems[pos] = 0;
        } else {
          golems[pos - 1] += golems[pos];
          golems[pos] = 0;
        }
      }
    } else if (d == 'R') {
      for (int i = vec.size() - 1; i >= 0; i--) {
        int pos = vec[i];
        if (pos == N - 1) {
          golems[pos] = 0;
        } else {
          golems[pos + 1] += golems[pos];
          golems[pos] = 0;
        }
      }
    }
  }
  int ans = 0;
  for (auto &e : golems) {
    ans += e;
  }
  cout << ans << endl;
  return 0;
}
