#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using Vint = vector<int>;
using Vlli = vector<lli>;
using Wint = vector<Vint>;
using Wlli = vector<Vlli>;
using pii = pair<int, int>;
using pll = pair<lli, lli>;
constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1),
                          make_pair(0, -1)};
constexpr char BR = '\n';
template <class T>
inline int argmin(vector<T> vec) {
  return min_element(vec.begin(), vec.end()) - vec.begin();
}
template <class T>
inline int argmax(vector<T> vec) {
  return max_element(vec.begin(), vec.end()) - vec.begin();
}
template <class T>
inline void chmax(T &a, T b) {
  a = max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = min(a, b);
}
inline int toInt(string &s) {
  int res = 0;
  for (char a : s) res = 10 * res + (a - '0');
  return res;
}
inline int toInt(const string s) {
  int res = 0;
  for (char a : s) res = 10 * res + (a - '0');
  return res;
}
inline long long int toLong(string &s) {
  lli res = 0;
  for (char a : s) res = 10 * res + (a - '0');
  return res;
}
inline long long int toLong(const string s) {
  lli res = 0;
  for (char a : s) res = 10 * res + (a - '0');
  return res;
}
template <class T>
inline std::string toString(T n) {
  if (n == 0) return "0";
  std::string res = "";
  if (n < 0) {
    n = -n;
    while (n != 0) {
      res += (char)(n % 10 + '0');
      n /= 10;
    }
    std::reverse(res.begin(), res.end());
    return '-' + res;
  }
  while (n != 0) {
    res += (char)(n % 10 + '0');
    n /= 10;
  }
  std::reverse(res.begin(), res.end());
  return res;
}
class Mike {
  const int NUM_ALPHA = 26;
  inline int AlphaToInt(char a) { return (int)(a - 'A'); }

 private:
  int n, q;
  Vint SIZES;
  vector<queue<int>> KARI;
  Wint Positions;
  Vint Data;

 public:
  Mike(int nn, int qq) {
    n = nn;
    q = qq;
    Data.resize(nn, 1);
    SIZES.resize(NUM_ALPHA, 0);
    KARI.resize(NUM_ALPHA);
    Positions.resize(NUM_ALPHA);
  }
  void inputStr(void) {
    string s;
    cin >> s;
    for (int(i) = (0); (i) < (n); (i)++) {
      int K = AlphaToInt(s.at(i));
      SIZES.at(K)++;
      KARI.at(K).push(i);
    }
    for (int(i) = (0); (i) < (NUM_ALPHA); (i)++) {
      Positions.at(i).resize(SIZES.at(i));
      for (int(j) = (0); (j) < (SIZES.at(i)); (j)++) {
        Positions.at(i).at(j) = KARI.at(i).front();
        KARI.at(i).pop();
      }
    }
  }
  void Q(char a, char b) {
    int u = AlphaToInt(a);
    int sz = SIZES.at(u);
    if (b == 'L') {
      for (int(i) = (0); (i) < (sz); (i)++) {
        int place = Positions.at(u).at(i);
        if (place != 0) Data.at(place - 1) += Data.at(place);
        Data.at(place) = 0;
      }
    } else {
      for (int(i) = ((sz - 1)); (i) >= (0); i--) {
        int place = Positions.at(u).at(i);
        if (place != n - 1) Data.at(place + 1) += Data.at(place);
        Data.at(place) = 0;
      }
    }
  }
  int SUM(void) {
    int res = 0;
    for (auto &(ele) : (Data)) res += ele;
    return res;
  }
};
int main(void) {
  int n, q;
  cin >> n >> q;
  Mike Takashi(n, q);
  Takashi.inputStr();
  for (int(_) = (0); (_) < (q); (_)++) {
    char p, q;
    cin >> p >> q;
    Takashi.Q(p, q);
  }
  cout << Takashi.SUM() << BR;
  return 0;
}
