#include <bits/stdc++.h>
using namespace std;
constexpr long long int linf = numeric_limits<long long int>::max() - 5;
constexpr int inf = numeric_limits<int>::max() - 5;
constexpr long long int mod = 1000000007;
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<int> v(n, 1);
  int result = n;
  map<char, deque<int>> mp;
  for (int i = 0; (i) < (n); i++) {
    mp[s[i]].push_back(i);
  }
  char t, d;
  int tmp;
  for (int i = 0; (i) < (q); i++) {
    cin >> t >> d;
    tmp = mp[t].size();
    if (d == 'L') {
      for (int j = 0; (j) < (tmp); j++) {
        if (mp[t].front() > 0) {
          v[mp[t].front() - 1] += v[mp[t].front()];
          v[mp[t].front()] = 0;
        } else {
          result -= v[0];
          v[0] = 0;
        }
        mp[t].push_back(mp[t].front());
        mp[t].pop_front();
      }
    } else {
      for (int j = 0; (j) < (tmp); j++) {
        if (mp[t].back() < n - 1) {
          v[mp[t].back() + 1] += v[mp[t].back()];
          v[mp[t].back()] = 0;
        } else {
          result -= v[n - 1];
          v[n - 1] = 0;
        }
        mp[t].push_front(mp[t].back());
        mp[t].pop_back();
      }
    }
  }
  cout << result << endl;
  return 0;
}
