#include <bits/stdc++.h>
const long long INF = 1000000007;
using namespace std;
struct point {
  int x;
  int y;
};
int gcd(int a, int b) {
  if (a > b) {
    return gcd(b, a);
  }
  return a == 0 ? b : gcd(b % a, a);
}
int lcm(int m, int n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
int input() {
  int x;
  cin >> x;
  return x;
}
int moji(char in) {
  int ans = (int)in - (int)'a';
  if ((ans < 0) || (ans > 25)) {
    ans = 26;
  }
  return ans;
}
const int VV = 1;
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s) {
  fill(d, d + VV, 100000);
  fill(used, used + VV, false);
  d[s] = 0;
  while (true) {
    cout << "Hello" << endl;
    int v = -1;
    for (int u = 0; u < VV; u++) {
      if (!used[u] && (v == -1 || d[u] < d[v])) v = u;
    }
    if (v == -1) break;
    used[v] = true;
    for (int u = 0; u < VV; u++) {
      d[u] = min(d[u], d[v] + cost[v][u]);
    }
  }
}
int compare_int(const void* a, const void* b) { return *(int*)a - *(int*)b; }
int binary_searchh(long long x, long long k[], int n) {
  int l = 0;
  int r = n;
  while (r - l >= 1) {
    int i = (l + r) / 2;
    if (k[i] == x)
      return i;
    else if (k[i] < x)
      l = i + 1;
    else
      r = i;
  }
  return -1;
}
struct File {
  int aa;
  int bb;
  File(const int& aa, const int& bb) : aa(aa), bb(bb) {}
};
bool operator<(const File& a, const File& b) {
  return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}
long long kaijo(long long x) {
  long long l = 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 + 7;
  long long sum = 1;
  for (int i = x; i > 0; i--) {
    sum *= i;
    if (sum > l) {
      sum %= l;
    }
  }
  return sum;
}
template <class T>
void chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
}
template <class T>
int former(const vector<T>& v, T x) {
  return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
template <class T>
int latter(const vector<T>& v, T x) {
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}
struct UnionFind {
  vector<int> par;
  vector<int> sizes;
  UnionFind(int n) : par(n), sizes(n, 1) {
    for (int i = 0; i < n; i++) {
      par[i] = i;
    }
  }
  int find(int x) {
    if (x == par[x]) {
      return x;
    }
    return par[x] = find(par[x]);
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) {
      return;
    }
    if (sizes[x] < sizes[y]) {
      swap(x, y);
    }
    par[y] = x;
    sizes[x] += sizes[y];
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return sizes[find(x)]; }
};
struct Edge {
  int a, b, cost;
  bool operator<(const Edge& o) const { return cost < o.cost; }
};
struct Graph {
  int n;
  vector<Edge> es;
  int kruskal() {
    sort(es.begin(), es.end());
    UnionFind uf(n);
    int min_cost = 0;
    for (int ei = 0; ei < es.size(); ei++) {
      Edge& e = es[ei];
      if (!uf.same(e.a, e.b)) {
        min_cost += e.cost;
        uf.unite(e.a, e.b);
      }
    }
    return min_cost;
  }
};
Graph input_graph() {
  Graph g;
  int m;
  cin >> g.n >> m;
  for (int i = 0; i < m; i++) {
    Edge e;
    cin >> e.a >> e.b >> e.cost;
    g.es.push_back(e);
  }
  return g;
}
long long labs(long long x) {
  if (x < 0) {
    return -x;
  }
  return x;
}
int main() {
  long long N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  char t[Q], d[Q];
  for (int i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }
  map<char, vector<int>> x;
  for (int i = 0; i < N; i++) {
    x[s.at(i)].push_back(i);
  }
  int mas[N];
  for (int i = 0; i < N; i++) {
    mas[i] = 1;
  }
  int sum = N;
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < x[t[i]].size(); j++) {
      int tmp = mas[x[t[i]][j]];
      if (d[i] == 'L') {
        mas[x[t[i]][j]] = 0;
        if (x[t[i]][j] == 0) {
          sum -= tmp;
        } else {
          mas[x[t[i]][j] - 1] += tmp;
        }
      } else {
        mas[x[t[i]][j]] = 0;
        if (x[t[i]][j] == N - 1) {
          sum -= tmp;
        } else {
          mas[x[t[i]][j] + 1] += tmp;
        }
      }
    }
  }
  cout << sum << endl;
}
