#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int N, Q;
  cin >> N >> Q;
  vector<int> grid(N, 1);
  map<int, char> mchr;
  string s;
  cin >> s;
  for (long long i = 0; i < (long long)s.size(); i++) {
    mchr[i] = s[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 (long long j = 0; j < (long long)N; j++) {
      if (mchr[j] == t[i]) {
        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;
}
