#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
char a[maxn];
char y[2];
int date[maxn];
vector<int> s[maxn];
int main() {
  int m, n;
  scanf("%d%d", &m, &n);
  scanf("%s", a + 1);
  for (int i = 1; i <= m; i++) {
    date[i] = 1;
    int x = a[i] - 'A' + 1;
    s[x].push_back(i);
  }
  int couts = 0;
  while (n--) {
    scanf("%s", y);
    int x = y[0] - 'A' + 1;
    if (y[1] == 'R') {
      for (int j = 0; j < s[x].size(); j++) {
        int w = date[s[x][j]];
        date[s[x][j]] = 0;
        date[s[x][j] + 1] += w;
      }
    } else {
      for (int j = 0; j < s[x].size(); j++) {
        int w = date[s[x][j]];
        date[s[x][j]] = 0;
        date[s[x][j] - 1] += w;
      }
    }
  }
  for (int i = 1; i <= m; i++) {
    if (date[i] > 0) {
      couts += date[i];
    }
  }
  cout << couts << endl;
  return 0;
}
