#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> index[26];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 26; j++)
      if (s[i] == 'A' + j) index[j].push_back(i);
  }
  vector<int> count(n, 1);
  int ans = 0;
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    int dir;
    if (d == 'L')
      dir = -1;
    else
      dir = 1;
    int id = t - 'A';
    if (dir == -1) {
      for (int j = 0; j < index[id].size(); j++) {
        if (index[id][j] == 0) {
          ans -= count[0];
          count[0] = 0;
        } else {
          count[index[id][j] - 1] += count[index[id][j]];
          count[index[id][j]] = 0;
        }
      }
    } else {
      for (int j = index[id].size() - 1; j >= 0; j--) {
        if (index[id][j] == n - 1) {
          ans -= count[n - 1];
          count[n - 1] = 0;
        } else {
          count[index[id][j] + 1] += count[index[id][j]];
          count[index[id][j]] = 0;
        }
      }
    }
  }
  cout << n + ans << endl;
}
