#include <bits/stdc++.h>
using namespace std;
struct node2 {
  int x;
  char y;
} z[100030];
int main() {
  int n, m;
  while (cin >> n >> m) {
    for (int i = 0; i < n; i++) {
      cin >> z[i].y;
      z[i].x = 1;
    }
    char a, b;
    for (int i = 0; i < m; i++) {
      cin >> a >> b;
      if (b == 'L') {
        for (int j = 0; j < n; j++) {
          if (z[j].y == a) {
            if (j == 0) {
              z[j].x = 0;
              continue;
            }
            z[j - 1].x += z[j].x;
            z[j].x = 0;
          }
        }
      } else if (b == 'R') {
        for (int j = n - 1; j >= 0; j--) {
          if (z[j].y == a) {
            if (j == n - 1) {
              z[j].x = 0;
              continue;
            }
            z[j + 1].x += z[j].x;
            z[j].x = 0;
          }
        }
      }
    }
    int sum = 0;
    for (int i = 0; i < n; i++) {
      sum += z[i].x;
    }
    cout << sum << endl;
  }
  return 0;
}
