#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  string s;
  char t, d;
  cin >> n >> q >> s;
  ;
  multimap<char, int> m;
  for (int i = 0; i < n; i++) {
    m.emplace(s[i], i);
  }
  vector<int> g(n, 1);
  int ans = n;
  for (int i = 0; i < q; i++) {
    cin >> t >> d;
    using iterator = decltype(m)::iterator;
    pair<iterator, iterator> ret = m.equal_range(t);
    for (iterator it = ret.first; it != ret.second; ++it) {
      int j = it->second;
      if ((j == 0 && d == 'L') || (j == n - 1 && d == 'R')) {
        ans -= g[j];
        g[j] = 0;
      } else {
        if (d == 'L') {
          g[j - 1] += g[j];
          g[j] = 0;
        } else {
          g[j + 1] += g[j];
          g[j] = 0;
        }
      }
    }
  }
  cout << ans << endl;
}
