#include <bits/stdc++.h>
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int, int> > qu2;
priority_queue<int> pq;
static const int NIL = -1;
static const int INF = 1000000007;
deque<int> deq;
long long N, M, H, W, K, Q, A, B;
string S;
const long long MOD = (1e+9) + 7;
bool chmx(int &a, int b) {
  if (b > a) {
    a = b;
    return true;
  }
  return false;
}
bool chmn(int &a, int b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
vector<int> mp[200005];
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  for (int i = 0; i < (int)(n); i++) mp[s[i] - 'A'].push_back(i);
  int go[n];
  for (int i = 0; i < (int)(n); i++) go[i] = 1;
  for (int i = 0; i < (int)(q); i++) {
    char t;
    char d;
    cin >> t >> d;
    if (d == 'L') {
      for (int u : mp[t - 'A']) {
        if (go[u] > 0) {
          if (u > 0) {
            go[u - 1] += go[u];
          }
          go[u] = 0;
        }
      }
    } else {
      for (int u : mp[t - 'A']) {
        if (go[u] > 0) {
          if (u < n - 1) {
            go[u + 1] += go[u];
          }
          go[u] = 0;
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < (int)(n); i++) {
    ans += go[i];
  }
  cout << ans << endl;
  return 0;
}
