#include <bits/stdc++.h>
using namespace std;
int n, q;
char s[200000];
int g[200000];
char t, d;
int ans;
int main() {
  cin >> n >> q;
  cin >> s;
  fill(g, g + n, 1);
  ans = n;
  for (int i = 0; i < q; ++i) {
    cin >> t >> d;
    if (d == 'R') {
      for (int j = n - 1; j >= 0; --j) {
        if (s[j] == t) {
          if (j == n - 1)
            ans -= g[j];
          else
            g[j + 1] += g[j];
          g[j] = 0;
        }
      }
    }
    if (d == 'L') {
      for (int j = 0; j < n; ++j) {
        if (s[j] == t) {
          if (j == 0)
            ans -= g[j];
          else
            g[j - 1] += g[j];
          g[j] = 0;
        }
      }
    }
  }
  cout << ans;
}
