#include <bits/stdc++.h>
using namespace std;
int sum_digits(int num);
template <class T>
vector<T> copy_vector(vector<T> vec);
vector<int> get_idx_of_move_gorem(string s, char target) {
  vector<int> rtn;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == target) {
      rtn.push_back(i);
    }
  }
  return rtn;
}
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<int> gorem_positions(n, 1);
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    vector<int> moving_pos_indexes = get_idx_of_move_gorem(s, t);
    for (int j = 0; j < moving_pos_indexes.size(); j++) {
      int idx = moving_pos_indexes[j];
      if (d == 'L') {
        if (idx != 0) {
          gorem_positions[idx - 1] += gorem_positions[idx];
        }
      } else {
        if (idx != n - 1) {
          gorem_positions[idx + 1] += gorem_positions[idx];
        }
      }
      gorem_positions[idx] = 0;
    }
  }
  int sum = 0;
  for (int i = 0; i < gorem_positions.size(); i++) {
    sum += gorem_positions[i];
  }
  cout << sum << endl;
  return 0;
}
int sum_digits(int num) {
  int rtn = 0;
  string num_str = to_string(num);
  for (int i = 0; i < num_str.size(); i++) {
    rtn += num_str[i] - '0';
  }
  return rtn;
}
template <class T>
vector<T> copy_vector(vector<T> vec) {
  vector<T> rtn;
  rtn.reserve(vec.size());
  copy(vec.begin(), vec.end(), back_inserter(rtn));
  return rtn;
}
