#include <bits/stdc++.h>
using namespace std;
map<char, vector<long long>> mahougin;
map<char, bool> any_on;
vector<long long> field;
vector<char> load;
signed main() {
  int N, Q;
  cin >> N >> Q;
  field.push_back(0);
  load.push_back('_');
  for (int i = 0; i < N; i++) {
    char a;
    cin >> a;
    mahougin[a].push_back(i + 1);
    field.push_back(1);
    any_on[a] = true;
    load.push_back(a);
  }
  load.push_back('-');
  field.push_back(0);
  for (int i = 0; i < Q; i++) {
    char t;
    char d;
    cin >> t >> d;
    if (!any_on[t]) continue;
    any_on[t] = false;
    long long l_or_r = d == 'R' ? 1 : -1;
    for (long long index : mahougin[t]) {
      field[index + l_or_r] += field[index];
      field[index] = 0;
      any_on[load[index + l_or_r]] = true;
    }
  }
  cout << N - (field[0] + field[N + 1]) << endl;
}
