#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef struct _Magic {
  char place;
  char move;
} Magic;
typedef struct _Field {
  char type;
  int golems;
} Field;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<Field> g(N);
  map<char, vector<int>> mp;
  for (int i = 0; i < (int)s.size(); ++i) {
    Field f;
    f.type = s[i];
    f.golems = 1;
    g[i] = f;
    mp[f.type].push_back(i);
    ;
  }
  vector<Magic> v(Q);
  for (int i = 0; i < Q; ++i) {
    Magic m;
    cin >> m.place >> m.move;
    v[i] = m;
  }
  int ans = 0;
  for (int i = 0; i < Q; ++i) {
    char p = v[i].place;
    char m = v[i].move;
    vector<int> target = mp[p];
    for (auto itr = target.begin(); itr != target.end(); ++itr) {
      int j = *itr;
      if (m == 'L') {
        if (j == 0) {
          ans += g[j].golems;
        } else {
          g[j - 1].golems += g[j].golems;
        }
        g[j].golems = 0;
      } else {
        if (j == N - 1) {
          ans += g[j].golems;
        } else {
          g[j + 1].golems += g[j].golems;
        }
        g[j].golems = 0;
      }
    }
  }
  cout << N - ans << endl;
}
