#include <bits/stdc++.h>
using namespace std;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
const int dx_8[] = {1, 1, 0, -1, -1, -1, 0, 1},
          dy_8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const long long MOD = 1e9 + 7;
template <typename T>
inline T GCD(T a, T b) {
  T c;
  while (b != 0) {
    c = a % b;
    a = b;
    b = c;
  }
  return a;
}
template <typename T>
inline T LCM(T a, T b) {
  T c = GCD(a, b);
  a /= c;
  return a * b;
}
template <typename T>
inline T nCr(T a, T b) {
  T i, r = 1;
  for (i = 1; i <= b; i++) {
    r *= (a + 1 - i);
    r /= i;
  }
  return r;
}
template <typename T>
inline T nHr(T a, T b) {
  return nCr(a + b - 1, b);
}
int n, q;
char t, d;
string s;
vector<int> g(200000);
map<char, vector<int> > mp;
int erase = 0;
void before() {
  for (char i = 'A'; i <= 'Z'; i++) {
    bool yes = 0;
    for (int j = 0; j < (n); ++j) {
      if (i == s[j]) {
        mp[i].emplace_back(j);
        yes = 1;
      }
    }
    if (!yes) mp[i].emplace_back(-1);
  }
}
void move(char c1, char c2) {
  if (c2 == 'L') {
    for (int idx : mp[c1]) {
      if (idx == -1) break;
      if (idx == 0)
        erase += g[idx];
      else
        g[idx - 1] += g[idx];
      g[idx] = 0;
    }
  } else {
    for (int i = mp[c1].size() - 1; i >= 0; i--) {
      if (mp[c1][i] == -1) break;
      if (mp[c1][i] == n - 1)
        erase += g[mp[c1][i]];
      else
        g[mp[c1][i] + 1] += g[mp[c1][i]];
      g[mp[c1][i]] = 0;
    }
  }
}
signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> q >> s;
  fill((g).begin(), (g).end(), 1);
  before();
  for (int i = 0; i < (q); ++i) {
    cin >> t >> d;
    move(t, d);
  }
  cout << n - erase << '\n';
  return 0;
}
