#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int N, Q;
  cin >> N >> Q;
  vector<pair<char, int>> mp;
  char a, b;
  for (int i = 0; i < N; i++) {
    cin >> a;
    mp.push_back(make_pair(a, 1));
  }
  int c;
  for (int i = 0; i < Q; i++) {
    cin >> a >> b;
    if (b == 'R') {
      for (auto it = mp.end(); it != mp.begin(); --it) {
        if (it->first == a) {
          auto itr = it;
          c = itr->second;
          itr->second = 0;
          if (itr != mp.end()) {
            itr++;
            itr->second += c;
          }
        }
      }
    } else {
      for (auto it = mp.begin(); it != mp.end(); ++it) {
        if (it->first == a) {
          auto itr = it;
          c = itr->second;
          itr->second = 0;
          if (itr != mp.begin()) {
            itr--;
            itr->second += c;
          }
        }
      }
    }
  }
  int ans = 0;
  for (auto it = mp.begin(); it != mp.end(); ++it) {
    ans += it->second;
  }
  cout << ans;
  return 0;
}
