#include <bits/stdc++.h>
using namespace std;
int main() {
  int num_golem, num_spell;
  cin >> num_golem >> num_spell;
  string golem;
  cin >> golem;
  unordered_map<char, vector<int>> m;
  int res = golem.size();
  for (int i = 0; i < golem.size(); ++i) {
    m[golem[i]].push_back(i);
  }
  vector<int> counts(golem.size(), 1);
  for (int i = 0; i < num_spell; ++i) {
    char type, operators;
    cin >> type >> operators;
    for (int j = 0; j < m[type].size(); ++j) {
      if (operators == 'L') {
        if (m[type][j] != 0) {
          counts[m[type][j] - 1] += counts[m[type][j]];
        } else
          res -= counts[m[type][j]];
        counts[m[type][j]] = 0;
      }
      if (operators == 'R') {
        if (m[type][j] != golem.size() - 1) {
          counts[m[type][j] + 1] += counts[m[type][j]];
        } else
          res -= counts[m[type][j]];
        counts[m[type][j]] = 0;
      }
    }
  }
  cout << res;
  return 0;
}
