#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  vector<vector<int>> map(26, vector<int>(0));
  for (int i = 1; i <= n; i++) {
    char c;
    cin >> c;
    map[c - 65].push_back(i);
  }
  for (vector<int> v : map) sort(v.begin(), v.end());
  vector<int> g(n + 2, 0);
  for (int i = 1; i <= n; i++) g[i] = 1;
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'L') {
      for (int j = 0; j < map[t - 65].size(); j++) {
        if (g[map[t - 65][j]] > 0) {
          g[map[t - 65][j] - 1] += g[map[t - 65][j]];
          g[map[t - 65][j]] = 0;
        }
      }
    } else {
      for (int j = map[t - 65].size() - 1; j >= 0; j--) {
        if (g[map[t - 65][j]] > 0) {
          g[map[t - 65][j] + 1] += g[map[t - 65][j]];
          g[map[t - 65][j]] = 0;
        }
      }
    }
  }
  cout << accumulate(g.begin() + 1, g.end() - 1, 0) << endl;
}
