#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int N, Q;
string s, after;
char t, d;
int num[200010];
map<char, int> mp;
int main() {
  cin >> N >> Q;
  cin >> s;
  for (int i = 1; i <= N; i++) {
    num[i] = 1;
  }
  num[0] = 0;
  num[N + 1] = 0;
  after = 'a' + s + 'z';
  int cnt = 0;
  for (int i = 0; i < Q; i++) {
    cin >> t >> d;
    if (d == 'L') {
      for (int j = 1; j <= N; j++) {
        if (after[j] == t) {
          num[j - 1] += num[j];
          num[j] = 0;
        }
      }
    } else if (d == 'R') {
      for (int j = N; j >= 1; j--) {
        if (after[j] == t) {
          num[j + 1] += num[j];
          num[j] = 0;
        }
      }
    }
  }
  cout << N - num[0] - num[N + 1] << endl;
}
