#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, q, con = 0, ans = 0;
  vector<vector<int>> table(26, vector<int>());
  string s;
  cin >> n >> q >> s;
  char move[q][2];
  for (int i = 0; i < q; i++) {
    cin >> move[i][0] >> move[i][1];
  }
  for (int i = 0; i < n; i++) {
    table[s[i] - 'A'].push_back(con);
    con++;
  }
  for (int i = 0; i < q; i++) {
    int x = move[i][0] - 'A';
    vector<int> tmp;
    if (move[i][1] == 'R') {
      for (int j = 0; j < table[x].size(); j++) {
        table[x][j]++;
        if (table[x][j] >= n) {
          ans++;
        } else {
          tmp.push_back(table[x][j]);
        }
      }
      table[x].clear();
      for (int j = 0; j < tmp.size(); j++) {
        table[s[tmp[j]] - 'A'].push_back(tmp[j]);
      }
    } else {
      for (int j = 0; j < table[x].size(); j++) {
        table[x][j]--;
        if (table[x][j] < 0) {
          ans++;
        } else {
          tmp.push_back(table[x][j]);
        }
      }
      table[x].clear();
      for (int j = 0; j < tmp.size(); j++) {
        table[s[tmp[j]] - 'A'].push_back(tmp[j]);
      }
    }
  }
  cout << n - ans << "\n";
  return 0;
}
