#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1};
int dx[] = {
    1,
    -1,
    0,
    0,
};
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<pair<vector<long long>, vector<long long>>> data(26);
  for (int i = 0; i < N; i++) {
    data[s[i] - 'A'].first.push_back(i);
    data[s[i] - 'A'].second.push_back(1);
  }
  int ans = 0;
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'L') {
      for (int j = 0; j < data[t - 'A'].first.size(); j++) {
        int temp = data[t - 'A'].second[j];
        if (!temp) continue;
        data[t - 'A'].second[j] = 0;
        if (data[t - 'A'].first[j] == 0) {
          ans += temp;
          continue;
        }
        for (int k = 0; k < 26; k++) {
          for (int l = 0; l < data[k].first.size(); l++) {
            if (data[k].first[l] == data[t - 'A'].first[j] - 1) {
              data[k].second[l] += temp;
            }
          }
        }
      }
    } else {
      for (int j = 0; j < data[t - 'A'].first.size(); j++) {
        int temp = data[t - 'A'].second[j];
        if (!temp) continue;
        data[t - 'A'].second[j] = 0;
        if (data[t - 'A'].first[j] == N - 1) {
          ans += temp;
          continue;
        }
        for (int k = 0; k < 26; k++) {
          for (int l = 0; l < data[k].first.size(); l++) {
            if (data[k].first[l] == data[t - 'A'].first[j] + 1) {
              data[k].second[l] += temp;
            }
          }
        }
      }
    }
  }
  cout << N - ans << endl;
}
