#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> idx[26];
  for (int i = 0; i < n; i++) {
    idx[s[i] - 'A'].push_back(i);
  }
  vector<pair<char, char>> td;
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    td.emplace_back(t, d);
  }
  vector<bool> fall(n);
  for (int i = q - 1; i >= 0; i--) {
    int t = td[i].first, d = td[i].second;
    if (d == 'L') {
      for (int k = (int)idx[t - 'A'].size() - 1; k >= 0; k--) {
        int j = idx[t - 'A'][k];
        if (j - 1 < 0 || fall[j - 1]) fall[j] = true;
      }
    } else {
      for (int j : idx[t - 'A']) {
        if (j + 1 >= n || fall[j + 1]) fall[j] = true;
      }
    }
  }
  int ans = 0;
  for (auto&& b : fall) {
    if (!b) ans++;
  }
  cout << ans << endl;
}
