#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j;
  char str[100005], str1[100005][2];
  int n, t;
  while (scanf("%d%d", &n, &t) != EOF) {
    getchar();
    int a[100005];
    for (i = 0; i < n; i++) {
      a[i] = 1;
    }
    scanf("%s", str);
    int sum = 0;
    for (i = 0; i < t; i++) {
      cin >> str1[i][0] >> str1[i][1];
      for (j = 0; j < n; j++) {
        if (str[j] == str1[i][0] && a[j] != 0) {
          if (str1[i][1] == 'R') {
            if (a[j] != n - 1) {
              a[j + 1] = a[j + 1] + a[j];
              a[j] = 0;
            } else {
              a[j] = 0;
            }
          }
          if (str1[i][1] == 'L') {
            if (a[j] != 0) {
              a[j - 1] = a[j - 1] + a[j];
              a[j] = 0;
            } else {
              a[j] = 0;
            }
          }
        }
      }
    }
    for (i = 0; i < n; i++) {
      sum = sum + a[i];
    }
    cout << sum << endl;
  }
  return 0;
}
