#include <bits/stdc++.h>
using namespace std;
long long a[200005];
vector<long long int> vv[30];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long i, j, n, q;
  string s;
  char t, d;
  cin >> n >> q >> s;
  for (i = 0; i < n; i++) {
    vv[(s[i] - 'A')].push_back(i);
    a[i] = 1;
  }
  long long cnt = 0;
  for (i = 0; i < q; i++) {
    cin >> t >> d;
    if (d == 'L') {
      for (auto it : vv[(t - 'A')]) {
        if (it == 0) {
          cnt += a[it];
        } else
          a[it - 1] += a[it];
        a[it] = 0;
      }
    } else {
      reverse((vv[t - 'A']).begin(), (vv[t - 'A']).end());
      for (auto it : vv[(t - 'A')]) {
        if (it == n - 1) {
          cnt += a[it];
        } else
          a[it + 1] += a[it];
        a[it] = 0;
      }
      reverse((vv[t - 'A']).begin(), (vv[t - 'A']).end());
    }
  }
  cout << n - cnt;
  return 0;
}
