#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long High = 1e16;
void ControlIO();
void TimerStart();
void TimerStop();
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1) {
  std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " = " << arg1;
  ZZ(comma, args...);
}
void solve() {
  int n, q;
  string str;
  cin >> n >> q;
  cin >> str;
  vector<int> Vect(n, 1);
  vector<vector<int>> Map(26);
  for (int i = 0; i < n; ++i) Map[str[i] - 'A'].push_back(i);
  int ans = 0;
  char ch1, ch2;
  while (q--) {
    cin >> ch1 >> ch2;
    if (ch2 == 'L') {
      for (int x : Map[ch2 - 'A']) {
        if (x == 0) {
          ans += Vect[0];
          Vect[0] = 0;
        } else {
          Vect[x - 1] += Vect[x];
          Vect[x] = 0;
        }
      }
    } else {
      for (int x : Map[ch2 - 'A']) {
        if (x == (n - 1)) {
          ans += Vect[x];
          Vect[x] = 0;
        } else {
          Vect[x + 1] += Vect[x];
          Vect[x] = 0;
        }
      }
    }
  }
  cout << n - ans;
}
int main() {
  ControlIO();
  int t = 1;
  TimerStart();
  while (t--) solve();
  TimerStop();
  return 0;
}
void ControlIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
auto TimeStart = chrono::steady_clock::now();
auto TimeEnd = chrono::steady_clock::now();
void TimerStart() {}
void TimerStop() {}
