#include <bits/stdc++.h>
using namespace std;
template <typename _KTy, typename _Ty>
ostream& operator<<(ostream& o, const pair<_KTy, _Ty>& m) {
  o << "{" << m.first << ", " << m.second << "}";
  return o;
}
template <typename _KTy, typename _Ty>
ostream& operator<<(ostream& o, const map<_KTy, _Ty>& m) {
  if (m.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << *m.begin();
  for (auto itr = ++m.begin(); itr != m.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _KTy, typename _Ty>
ostream& operator<<(ostream& o, const unordered_map<_KTy, _Ty>& m) {
  if (m.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << *m.begin();
  for (auto itr = ++m.begin(); itr != m.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const vector<_Ty>& v) {
  if (v.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << v.front();
  for (auto itr = ++v.begin(); itr != v.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const set<_Ty>& s) {
  if (s.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << *(s.begin());
  for (auto itr = ++s.begin(); itr != s.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const unordered_set<_Ty>& s) {
  if (s.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << *(s.begin());
  for (auto itr = ++s.begin(); itr != s.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const stack<_Ty>& s) {
  if (s.empty()) {
    o << "{ }";
    return o;
  }
  stack<_Ty> t(s);
  o << "{" << t.top();
  t.pop();
  while (!t.empty()) {
    o << ", " << t.top();
    t.pop();
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const list<_Ty>& l) {
  if (l.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << l.front();
  for (auto itr = ++l.begin(); itr != l.end(); ++itr) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _KTy, typename _Ty>
istream& operator>>(istream& is, pair<_KTy, _Ty>& m) {
  is >> m.first >> m.second;
  return is;
}
template <typename _Ty>
istream& operator>>(istream& is, vector<_Ty>& v) {
  for (size_t i = 0; i < v.size(); i++) is >> v[i];
  return is;
}
namespace aux {
template <typename Ty, unsigned N, unsigned L>
struct tp {
  static void print(ostream& os, const Ty& v) {
    os << get<N>(v) << ", ";
    tp<Ty, N + 1, L>::print(os, v);
  }
};
template <typename Ty, unsigned N>
struct tp<Ty, N, N> {
  static void print(ostream& os, const Ty& v) { os << get<N>(v); }
};
}  // namespace aux
template <typename... Tys>
ostream& operator<<(ostream& os, const tuple<Tys...>& t) {
  os << "{";
  aux::tp<tuple<Tys...>, 0, sizeof...(Tys) - 1>::print(os, t);
  os << "}";
  return os;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T& val) {
  std::fill((T*)array, (T*)(array + N), val);
}
void dump_func() { cerr << endl; }
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail) {
  cerr << head;
  if (sizeof...(Tail) == 0) {
    cerr << " ";
  } else {
    cerr << ", ";
  }
  dump_func(std::move(tail)...);
}
class timer {
  vector<timer> timers;
  int n = 0;

 public:
  double limit = 9.85;
  double t = 0;
  timer() {}
  timer(int size) : timers(size) {}
  bool elapses() const { return time() - t > limit; }
  void measure() {
    t = time() - t;
    ++n;
  }
  void measure(char id) { timers[id].measure(); }
  void print() {
    if (n % 2) measure();
    for (int i = 0; i < 128; ++i) {
      if (timers[i].n) cerr << (char)i << ' ' << timers[i].t << 's' << endl;
    }
    cerr << "  " << t << 's' << endl;
  }
  static double time() {
    unsigned long long a, d;
    __asm__ volatile("rdtsc" : "=a"(a), "=d"(d));
    return (d << 32 | a) / 2.8e9;
  }
} timer(128);
struct SXor128 {
  unsigned x, y, z, w;
  SXor128() {
    x = 123456789;
    y = 362436069;
    z = 521288629;
    w = 88675123;
  }
  SXor128(int _w) {
    x = 123456789;
    y = 362436069;
    z = 521288629;
    w = _w;
  }
  void setSeed() {
    x = 123456789;
    y = 362436069;
    z = 521288629;
    w = 88675123;
  }
  void setSeed(int _w) {
    x = 123456789;
    y = 362436069;
    z = 521288629;
    w = _w;
  }
  unsigned nextUInt() {
    unsigned t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
  }
  unsigned nextUInt(unsigned mod) {
    unsigned t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
    return w % mod;
  }
  unsigned nextUInt(unsigned l, unsigned r) {
    unsigned t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
    return w % (r - l + 1) + l;
  }
  double nextDouble() { return double(nextUInt()) / UINT_MAX; }
} rnd;
struct MyVec {
  int* data;
  size_t sz;
  MyVec() {}
  MyVec(size_t reserve) {
    data = new int[reserve];
    sz = 0;
  }
  void pb(int x) { data[sz++] = x; }
};
int pos[26][200000];
int sz[26];
int cnt[200002];
int solveNaiveFast(int N, int Q, string s, vector<char> t, vector<char> d) {
  for (int p = 0; p < N; p++) {
    int c = s[p] - 'A';
    pos[c][sz[c]++] = p + 1;
  }
  for (int i = (0); i < (N + 2); ++i) cnt[i] = 1;
  for (int q = 0; q < Q; q++) {
    int c = t[q] - 'A';
    if (d[q] == 'L') {
      for (int i = 0; i < sz[c]; i++) {
        int p = pos[c][i];
        cnt[p - 1] += cnt[p];
        cnt[p] = 0;
      }
    } else {
      for (int i = sz[c] - 1; i >= 0; i--) {
        int p = pos[c][i];
        cnt[p + 1] += cnt[p];
        cnt[p] = 0;
      }
    }
  }
  int ans = 0;
  for (int p = 1; p <= N; p++) ans += cnt[p];
  return ans;
}
int solveNaive(int N, int Q, string s, vector<char> t, vector<char> d) {
  vector<vector<int>> pos(26);
  for (int p = 0; p < N; p++) pos[s[p] - 'A'].push_back(p + 1);
  vector<int> cnt(N + 2, 1);
  for (int q = 0; q < Q; q++) {
    int c = t[q];
    const vector<int>& v = pos[c - 'A'];
    if (d[q] == 'L') {
      for (int i = 0; i < v.size(); i++) {
        int p = v[i];
        cnt[p - 1] += cnt[p];
        cnt[p] = 0;
      }
    } else {
      for (int i = (int)v.size() - 1; i >= 0; i--) {
        int p = v[i];
        cnt[p + 1] += cnt[p];
        cnt[p] = 0;
      }
    }
  }
  int ans = 0;
  for (int p = 1; p <= N; p++) ans += cnt[p];
  return ans;
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  vector<char> t(Q), d(Q);
  for (int i = (0); i < (Q); ++i) cin >> t[i] >> d[i];
  cout << solveNaiveFast(N, Q, s, t, d) << endl;
  return 0;
}
