#include <bits/stdc++.h>
long long const MOD = 1e9 + 7;
long long const INF = 1e18;
using namespace std;
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  s = "aa" + s + "aa";
  vector<pair<char, char>> v(q);
  for (auto& i : v) {
    cin >> i.first >> i.second;
  }
  vector<bool> flag(n + 4, true);
  int left = 1, right = n + 2;
  for (int(i) = (q)-1; (i) >= 0; (i)--) {
    if (v[i].second == 'L') {
      if (s[left + 1] == v[i].first) left++;
      if (s[right + 1] == v[i].first) right++;
    } else {
      if (s[left - 1] == v[i].first) left--;
      if (s[right - 1] == v[i].first) right--;
    }
    flag[left] = false;
    flag[right] = false;
  }
  int ans = 0;
  for (int i = 2; i < n + 2; i++) {
    if (flag[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}
