#include <bits/stdc++.h>
using namespace std;
int n, q;
typedef struct {
  char word;
  int has_golem;
  int will_move_golem;
} grid;
int move_golem(char text, char dir, vector<grid> &grids) {
  for (int i = 0; i < n; i++) {
    if (grids[i].word == text && grids[i].has_golem != 0) {
      int moved_golem = grids[i].has_golem;
      grids[i].has_golem = 0;
      if (dir == 'L' && i != 0) {
        grids[i - 1].will_move_golem += moved_golem;
      } else if (dir == 'R' and i != n - 1) {
        grids[i + 1].will_move_golem += moved_golem;
      }
    } else {
      continue;
    }
  }
  int sum_golem = 0;
  for (int i = 0; i < n; i++) {
    grids[i].has_golem += grids[i].will_move_golem;
    sum_golem += grids[i].has_golem;
    grids[i].will_move_golem = 0;
  }
  return sum_golem;
}
int answer(vector<grid> &grids) {
  int sum_golem = 0;
  for (int i = 0; i < n; i++) {
    sum_golem += grids[i].has_golem;
  }
  return sum_golem;
}
int main() {
  cin >> n >> q;
  string s;
  cin >> s;
  vector<grid> grids;
  for (int i = 0; i < n; i++) {
    grid tmp = {s[i], 1, 0};
    grids.push_back(tmp);
  }
  for (int i = 0; i < q; i++) {
    char text, dir;
    cin >> text >> dir;
    if (move_golem(text, dir, grids) == 0) {
      cout << "0" << endl;
      return 0;
    }
  }
  cout << answer(grids) << endl;
  return 0;
}
