#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  map<char, vector<int>> mp;
  vector<int> v(n, 1);
  for (int i = 0; i <= ((int)(s).size()) - 1; i++) {
    if (!mp.count(s[i])) mp[s[i]] = vector<int>();
    mp[s[i]].emplace_back(i);
  }
  char id, dir;
  int cnt = 0;
  for (int index = 0; index <= q - 1; index++) {
    cin >> id >> dir;
    for (auto i : mp[id]) {
      if (dir == 'L') {
        if (i == 0)
          cnt += v[i];
        else
          v[i - 1] += v[i];
        v[i] = 0;
      } else {
        if (i == n - 1)
          cnt += v[i];
        else
          v[i + 1] += v[i];
        v[i] = 0;
      }
    }
  }
  cout << n - cnt << "\n";
  return 0;
}
