#include <bits/stdc++.h>
using namespace std;
map<long long, set<long long>> l;
map<long long, long long> mp;
map<long long, long long> m;
vector<long long> v[999];
int main() {
  long long n, q;
  cin >> n >> q;
  char x, y;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    v[s[i] - 'A'].push_back(i);
    mp[i] = 1;
  }
  long long ans = n;
  for (int i = 0; i < q; i++) {
    cin >> x >> y;
    if (y == 'R') {
      for (int h = 0; h < v[x - 'A'].size(); h++) {
        long long b = v[x - 'A'][h];
        if (mp[b]) {
          if (b == n - 1) {
            ans -= mp[b];
          } else {
            if (s[b + 1] == x) {
              m[b + 1] = mp[b];
            } else {
              mp[b + 1] += mp[b];
            }
            mp[b] = m[b];
            m[b] = 0;
          }
        }
      }
    } else {
      for (int h = v[x - 'A'].size() - 1; h >= 0; h--) {
        long long b = v[x - 'A'][h];
        if (b == 0) {
          ans -= mp[b];
        } else {
          if (s[b - 1] == x) {
            m[b - 1] = mp[b];
          } else {
            mp[b - 1] += mp[b];
          }
        }
        mp[b] = m[b];
        m[b] = 0;
      }
    }
  }
  cout << ans;
}
