#include <bits/stdc++.h>
using namespace std;
template <typename T>
T mod(T a, T b) {
  return (a + b) % b;
}
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
map<long long, long long> factor(long long n) {
  map<long long, long long> mp;
  for (long long i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      mp[i]++;
      n /= i;
    }
  }
  if (n > 1) {
    mp[n]++;
  }
  return mp;
}
int chartoi(char c) { return c - 'A'; }
void solve() {
  long long N, Q;
  cin >> N >> Q;
  string str;
  cin >> str;
  vector<vector<int>> pos(26, vector<int>());
  for (int i = 0; i < N; i++) {
    pos[chartoi(str[i])].push_back(i);
  }
  for (int jumon = 0; jumon < Q; jumon++) {
    char s, t;
    cin >> s >> t;
    if (t == 'R') {
      for (int i = (int)pos[chartoi(s)].size() - 1; i >= 0; i--) {
        int idx = pos[chartoi(s)][i];
        if (idx + 1 < N) {
          pos[chartoi(str[idx + 1])].push_back(idx + 1);
        }
        pos[chartoi(s)].pop_back();
      }
    } else {
      for (int i = (int)pos[chartoi(s)].size() - 1; i >= 0; i--) {
        int idx = pos[chartoi(s)][i];
        if (idx - 1 >= 0) {
          pos[chartoi(str[idx - 1])].push_back(idx - 1);
        }
        pos[chartoi(s)].pop_back();
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < 26; i++) {
    ans += (long long)pos[i].size();
  }
  cout << ans << endl;
  return;
}
int main(int argc, char const* argv[]) {
  solve();
  return 0;
}
