#include <bits/stdc++.h>
using namespace std;
char s[200000];
int cage[200000];
int n, q;
int const LEFT = 0;
int const RIGHT = 1;
void exec(int i, int intOrd) {
  if ((i == 0 && intOrd == LEFT) || (i == n - 1 && intOrd == RIGHT)) {
    cage[i] = 0;
    return;
  }
  switch (intOrd) {
    case LEFT:
      cage[i - 1] += cage[i];
      cage[i] = 0;
      break;
    case RIGHT:
      cage[i + 1] += cage[i];
      cage[i] = 0;
      break;
  }
}
void move(char key, int order) {
  int i;
  for (i = 0; i < n; i++) {
    if (s[i] == key) {
      exec(i, order);
    }
  }
}
void test() {
  int i;
  for (i = 0; i < n; i++) {
    cout << cage[i] << " ";
  }
  cout << endl;
}
int main() {
  cin >> n;
  cin >> q;
  cin >> s;
  int i;
  for (i = 0; i < n; i++) {
    cage[i] = 1;
  }
  for (i = 0; i < q; i++) {
    char t, d;
    cin >> t;
    cin >> d;
    int order;
    if (d == 'L')
      order = LEFT;
    else
      order = RIGHT;
    move(t, order);
  }
  int count = 0;
  for (i = 0; i < n; i++) {
    count += cage[i];
  }
  cout << count << endl;
  return 0;
}
