#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int N, Q;
  cin >> N >> Q;
  vector<int> grid(N, 1);
  string s;
  cin >> s;
  map<char, vector<int>> mchr;
  for (long long i = 0; i < (long long)s.size(); i++) {
    mchr[s[i]].push_back(i);
  }
  vector<char> t(Q, 0);
  vector<char> d(Q, 0);
  for (long long i = 0; i < (long long)Q; i++) {
    cin >> t[i] >> d[i];
  }
  for (long long i = 0; i < (long long)Q; i++) {
    for (int k = 0; k < mchr[t[i]].size(); k++) {
      int j = mchr[t[i]][k];
      if (grid[j] > 0) {
        int tmp = grid[j];
        grid[j] -= tmp;
        if (d[i] == 'R') {
          if (j + 1 < N) {
            grid[j + 1] += tmp;
          }
        } else if (d[i] == 'L') {
          if (j - 1 >= 0) {
            grid[j - 1] += tmp;
          }
        }
      }
    }
  }
  cout << accumulate(grid.begin(), grid.end(), 0) << endl;
}
