#include <bits/stdc++.h>
using namespace std;
int n, q;
string s;
char a, b;
vector<int> v[30];
vector<pair<int, int> > tt;
int main() {
  scanf("%d%d", &n, &q);
  cin >> s;
  for (int i = 0; i < n; i++) {
    v[(int)s[i] - 65].push_back(i);
  }
  for (int i = 0; i < q; i++) {
    scanf(" %c %c", &a, &b);
    tt.clear();
    for (vector<int>::iterator it = v[(int)a - 65].begin();
         it != v[(int)a - 65].end(); it++) {
      if (b == 'L') {
        if (*it == 0) continue;
        tt.push_back(make_pair((int)s[*it - 1] - 65, *it - 1));
      } else {
        if (*it == n - 1) continue;
        tt.push_back(make_pair((int)s[*it + 1] - 65, *it + 1));
      }
    }
    v[(int)a - 65].clear();
    for (vector<pair<int, int> >::iterator it = tt.begin(); it != tt.end();
         it++) {
      v[it->first].push_back(it->second);
    }
    tt.clear();
  }
  int total = 0;
  for (int i = 0; i < 26; i++) {
    total += v[i].size();
  }
  printf("%d\n", total);
}
