#include <bits/stdc++.h>
using ull = unsigned long long;
using namespace std;
template <typename T>
inline void dump(const T& x) {
  cout << "[" << x << "]" << endl;
}
template <typename T>
inline void dump(const vector<T>& x) {
  for (const auto v : x) {
    cout << v << " ";
  }
  cout << endl;
}
template <typename T>
inline void sort_asc(vector<T>& x) {
  std::sort(x.begin(), x.end());
}
template <typename T>
inline void sort_desc(vector<T>& x) {
  std::sort(x.begin(), x.end(), greater<T>());
}
int main() {
  ull n, q;
  string s;
  cin >> n >> q;
  cin >> s;
  unordered_map<char, vector<bool>> orders;
  unordered_map<char, tuple<long long, long long, long long>> edges;
  for (auto i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    bool is_left = true;
    if (d == 'R') {
      is_left = false;
    }
    if (edges.count(t) == 0) {
      tuple<long long, long long, long long> ttt = make_tuple(0, 0, 0);
      edges.emplace(t, move(ttt));
    }
    auto current = get<0>(edges[t]);
    auto lmin = get<1>(edges[t]);
    auto rmax = get<2>(edges[t]);
    if (is_left) {
      current--;
    } else {
      current++;
    }
    lmin = min(current, lmin);
    rmax = max(current, rmax);
    edges[t] = make_tuple(current, lmin, rmax);
  }
  for (const auto& v : edges) {
    cout << v.first << " : " << get<1>(v.second) << " : " << get<2>(v.second)
         << endl;
  }
  ull result = n;
  for (auto i = 0; i < n; i++) {
    auto current = s[i];
    if (edges.count(current) == 0) {
      continue;
    }
    auto left = get<1>(edges[current]);
    auto right = get<2>(edges[current]);
    auto index = i + 1;
    if (((index + left) <= 0) || ((index + right) > n)) {
      result--;
    }
  }
  cout << result << endl;
  return 0;
}
