#include <bits/stdc++.h>
using namespace std;
int sum_digits(int num);
template <class T>
vector<T> copy_vector(vector<T> vec);
map<char, vector<int>> get_idx_of_move_golem(string s) {
  map<char, vector<int>> rtn;
  for (int i = 0; i < s.size(); i++) {
    char ch = s[i];
    if (rtn.count(ch) > 0) {
      rtn[ch].push_back(i);
    } else {
      vector<int> tmp{i};
      rtn[ch] = tmp;
    }
  }
  return rtn;
}
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<int> golem_positions(n, 1);
  map<char, vector<int>> pos_map = get_idx_of_move_golem(s);
  int count = n;
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    vector<int> moving_pos_indexes = pos_map[t];
    for (int j = 0; j < moving_pos_indexes.size(); j++) {
      int idx = moving_pos_indexes[j];
      if (d == 'L') {
        if (idx != 0) {
          golem_positions[idx - 1] += golem_positions[idx];
        } else {
          count -= golem_positions[idx];
        }
      } else {
        if (idx != n - 1) {
          golem_positions[idx + 1] += golem_positions[idx];
        } else {
          count -= golem_positions[idx];
        }
      }
      golem_positions[idx] = 0;
    }
  }
  cout << count << 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;
}
