#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll mod = 1e9 + 7;
int main() {
  int n, q;
  cin >> n >> q;
  vector<int> go(n, 1);
  map<char, vector<int>> masu;
  for (int i = 0; i < n; i++) {
    char c;
    cin >> c;
    masu[c].push_back(i);
  }
  int cnt = n;
  for (int i = 0; i < q; i++) {
    char t;
    char d;
    cin >> t >> d;
    map<int, int> taihi;
    int shift = 0;
    if (d == 'R')
      shift = 1;
    else
      shift = -1;
    for (int basyo : masu[t]) {
      if ((basyo + shift) < 0) {
        cnt -= go[0];
        go[0] = 0;
      } else if ((basyo + shift) >= n) {
        cnt -= go[n - 1];
        go[n - 1] = 0;
      } else {
        taihi[basyo + shift] = go[basyo];
        go[basyo] = 0;
      }
    }
    for (auto j : taihi) {
      int basyo = j.first;
      go[basyo] += j.second;
    }
  }
  cout << cnt << endl;
  return 0;
}
