#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
const int INF = 1e9 + 7;
int c[N], a[N];
int n, m, ans;
string s;
vector<int> v[200];
queue<int> q;
int main() {
  cin >> n >> m >> s;
  for (int i = 0; i < n; i++) {
    c[i]++;
    v[(int)s[i]].push_back(i);
  }
  ans = n;
  for (int i = 1; i <= m; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'L') {
      for (int it : v[(int)t]) {
        if (it != 0) {
          a[it - 1] += c[it];
          q.push(it - 1);
        } else
          ans -= c[it];
        c[it] = 0;
      }
    } else {
      for (int it : v[(int)t]) {
        if (it != n - 1) {
          a[it + 1] += c[it];
          q.push(it + 1);
        } else
          ans -= c[it];
        c[it] = 0;
      }
    }
    while (!q.empty()) {
      int cur = q.front();
      q.pop();
      c[cur] += a[cur];
      a[cur] = 0;
    }
  }
  cout << ans;
}
