#include <bits/stdc++.h>
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
const long long BIG = 1000000007LL;
int inputValue() {
  int a;
  cin >> a;
  return a;
};
template <typename T>
void inputArray(T* p, int a) {
  for (int i = (0); i < (a); i++) {
    cin >> p[i];
  }
};
template <typename T>
void inputVector(vector<T>* p, int a) {
  for (int i = (0); i < (a); i++) {
    T input;
    cin >> input;
    p->push_back(input);
  }
}
template <typename T>
void output(T a, int precision = 0) {
  if (precision > 0) {
    cout << setprecision(precision) << a << "\n";
  } else {
    cout << a << "\n";
  }
}
const int Max = 210000;
string s;
map<char, vector<int>> smap;
pair<char, char> td[Max];
int golems[Max];
int N, Q;
int main(int argc, const char* argv[]) {
  cin >> N >> Q >> s;
  for (int i = (0); i < (s.length()); i++) {
    smap[s[i]].push_back(i);
    golems[i] = 1;
  }
  for (int i = (0); i < (Q); i++) {
    char t;
    char d;
    cin >> t >> d;
    td[i] = make_pair(t, d);
  }
  for (int i = (0); i < (Q); i++) {
    auto& pos = smap[td[i].first];
    int ofs = td[i].second == 'R' ? 1 : -1;
    if (ofs > 0) {
      for (auto p = pos.rbegin(); p < pos.rend(); p++) {
        int next = *p + ofs;
        if (next >= 0 && next < N) {
          golems[next] += golems[*p];
        }
        if (golems[*p] > 0) {
          golems[*p] = 0;
        }
      }
    } else {
      for (auto p = pos.begin(); p < pos.end(); p++) {
        int next = *p + ofs;
        if (next >= 0 && next < N) {
          golems[next] += golems[*p];
        }
        if (golems[*p] > 0) {
          golems[*p] = 0;
        }
      }
    }
  }
  int ans = 0;
  for (int i = (0); i < (N); i++) {
    ans += golems[i];
  }
  output(ans);
  return 0;
}
