#include <bits/stdc++.h>
using namespace std;
const int INF = 1e7;
const long long MOD = 1e9 + 7;
map<char, vector<int>> table;
vector<int> v;
int main() {
  int n, q;
  string s;
  cin >> n >> q;
  cin >> s;
  v.resize(n);
  for (int i = 0; i < n; i++) {
    v[i] = 1;
    table[s[i]].push_back(i);
  }
  int sna = 0;
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'L') {
      for (int j = 0; j < table[t].size(); j++) {
        if (table[t][j] == 0) {
          sna += v[0];
          v[0] = 0;
        } else {
          int idx = table[t][j];
          v[idx - 1] += v[idx];
          v[idx] = 0;
        }
      }
    } else {
      for (int j = table[t].size() - 1; j >= 0; j--) {
        if (table[t][j] == n - 1) {
          sna += v[n - 1];
          v[n - 1] = 0;
        } else {
          int idx = table[t][j];
          v[idx + 1] += v[idx];
          v[idx] = 0;
        }
      }
    }
  }
  int ans = n - sna;
  cout << ans << endl;
  return 0;
}
