#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, q;
  cin >> n >> q;
  char c, a, b;
  map<char, vector<long long int>> mp;
  map<long long int, vector<char>> np;
  for (long long int i = 0; i < n; i++) {
    cin >> c;
    mp[c].push_back(i);
    np[i].push_back(c);
  }
  while (q--) {
    cin >> a >> b;
    if (b == 'L') {
      for (long long int i : mp[a]) {
        if (i == 0)
          np[0].clear();
        else {
          np[i - 1].insert(np[i - 1].end(), np[i].begin(), np[i].end());
          np[i].clear();
        }
      }
    } else if (b == 'R') {
      vector<long long int> k;
      k = mp[a];
      for (auto it = k.rbegin(); it != k.rend(); it++) {
        if (*it == (n - 1))
          np[n - 1].clear();
        else {
          np[(*it) + 1].insert(np[(*it) + 1].end(), np[*it].begin(),
                               np[*it].end());
          np[*it].clear();
        }
      }
    }
  }
  long long int kpc = 0;
  for (auto it = np.begin(); it != np.end(); it++) {
    kpc = kpc + (it->second).size();
  }
  cout << kpc << '\n';
  return 0;
}
