#include <bits/stdc++.h>
using namespace std;
long long inf = 1e9 + 7;
template <typename T>
vector<vector<T> > input_graph(T array_num, T edge_num) {
  static_assert(is_same<T, int>::value || is_same<T, long long>::value,
                "this input_graph function can only be in type \"int\" or "
                "\"long long int\"!\n");
  vector<vector<T> > a(array_num, vector<T>());
  for (T i = 0; i < edge_num; i++) {
    T d1, d2;
    cin >> d1 >> d2;
    a.at(d1 - 1).emplace_back(d2 - 1);
    a.at(d2 - 1).emplace_back(d1 - 1);
  }
  return a;
}
template <typename T>
vector<T> input_vector(T array_num) {
  static_assert(is_same<T, int>::value || is_same<T, long long>::value,
                "this input_vector function can only be in type \"int\" or "
                "\"long long int\"!\n");
  vector<T> a(array_num, 0);
  for (T i = 0; i < array_num; i++) {
    cin >> a.at(i);
  }
  return a;
}
int main() {
  int n, k, d;
  cin >> n >> k;
  char c1, c2;
  vector<int> a(n, 1);
  vector<vector<int> > b(26, vector<int>());
  for (int i = 0; i < n; i++) {
    cin >> c1;
    b.at(c1 - 'A').push_back(i);
  }
  for (int i = 0; i < k; i++) {
    cin >> c1 >> c2;
    for (vector<int>::iterator it = b.at(c1 - 'A').begin();
         it != b.at(c1 - 'A').end(); ++it) {
      if (*it == 0) {
        if (c2 == 'R') {
          a.at((*it) + 1) += a.at(*it);
        }
        a.at(*it) = 0;
      } else if (*it == n - 1) {
        if (c2 == 'L') {
          a.at((*it) - 1) += a.at(*it);
        }
        a.at(*it) = 0;
      } else {
        if (c2 == 'L') {
          a.at((*it) - 1) += a.at(*it);
        } else {
          a.at((*it) + 1) += a.at(*it);
        }
        a.at(*it) = 0;
      }
    }
  }
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    sum += (long long)a.at(i);
  }
  cout << sum;
  return 0;
}
