#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1000000007;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int N, Q;
string s;
vector<int> golems;
std::unordered_map<char, vector<int> > chars;
void solve() {
  cin >> N >> Q >> s;
  golems.resize(N, 1);
  for (int i = 0; i < N; i++) {
    chars[s[i]].emplace_back(i);
  }
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'L') {
      for (int j = 0; j < chars[t].size(); j++) {
        if (golems[chars[t][j]] > 0) {
          if (chars[t][j] > 0) {
            golems[chars[t][j] - 1] += golems[chars[t][j]];
          }
          golems[chars[t][j]] = 0;
        }
      }
    } else {
      for (int j = chars[t].size() - 1; j >= 0; j--) {
        if (golems[chars[t][j]] > 0) {
          if (chars[t][j] < N - 1) {
            golems[chars[t][j] + 1] += golems[chars[t][j]];
          }
          golems[chars[t][j]] = 0;
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < golems.size(); i++) {
    ans += golems[i];
  }
  cout << ans << '\n';
  return;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
