#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string str;
  cin >> str;
  vector<int> alp[26];
  for (int i = 0; i < n; i++) {
    alp[str.at(i) - 'A'].push_back(i);
  }
  pair<char, char> arr[q];
  char x, y;
  for (int i = 0; i < q; i++) {
    cin >> x >> y;
    arr[i] = make_pair(x, y);
  }
  int left = -1;
  int right = n;
  for (int i = q - 1; i >= 0; i--) {
    if (arr[i].second == 'L') {
      if (binary_search(alp[arr[i].first - 'A'].begin(),
                        alp[arr[i].first - 'A'].end(), left + 1))
        left++;
    } else {
      if (binary_search(alp[arr[i].first - 'A'].begin(),
                        alp[arr[i].first - 'A'].end(), right - 1))
        right--;
    }
  }
  cout << right - left - 1 << "\n";
}
