#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int64_t>>;
using WeightedGraph = vector<vector<pair<int64_t, int64_t>>>;
const int64_t INF = 2000000000;
const long double PI = acosl(-1);
const int64_t MOD = 1000000007;
void print() { cout << "\n"; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T>& vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << "\n";
}
template <class T>
void print(vector<vector<T>>& df) {
  for (auto& vec : df) {
    print(vec);
  }
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(10);
  int64_t ans = 0;
  int64_t N, Q;
  string s;
  cin >> N >> Q;
  vector<char> t(Q), d(Q);
  cin >> s;
  map<char, vector<pair<int64_t, int64_t>>> S;
  for (int64_t i = 0; (i) < (int64_t)(N); ++(i))
    S[s[i]].push_back({-i - 1, N - i});
  unordered_map<char, int64_t> mp;
  for (int64_t i = 0; (i) < (int64_t)(Q); ++(i)) {
    cin >> t[i] >> d[i];
    mp[t[i]] += (d[i] == 'L' ? -1 : 1);
  }
  for (auto i : mp) {
    for (auto j : S[i.first]) {
      if (i.second <= j.first || j.second <= i.second) {
        ans++;
      }
    }
  }
  print(N - ans);
  return 0;
}
