#include <bits/stdc++.h>
using namespace std;
int main() {
  map<char, vector<int>> mp;
  char a[200200];
  int f[200200];
  int n, m, ans;
  cin >> n >> m;
  ans = n;
  for (int i = 0; i < n; i++) f[i] = 1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]].push_back(i);
  }
  for (int i = 0; i < m; i++) {
    char x, y;
    cin >> x >> y;
    if (y == 'L') {
      for (int j : mp[x]) {
        if (j == 0)
          ans -= f[j];
        else
          f[j - 1] += f[j];
        f[j] = 0;
      }
    }
    if (y == 'R') {
      for (int j = mp[x].size() - 1; j >= 0; j--) {
        if (mp[x][j] == n - 1)
          ans -= f[mp[x][j]];
        else
          f[mp[x][j] + 1] += f[mp[x][j]];
        f[mp[x][j]] = 0;
      }
    }
  }
  cout << ans;
}
