#include <bits/stdc++.h>
int main() {
  int g[2 * 100000];
  int N, Q;
  std::cin >> N >> Q;
  std::string S;
  std::cin >> S;
  for (int i = 0; i < N; ++i) {
    g[i] = 1;
  }
  char t, d;
  int temp;
  int ans = N;
  for (int i = 0; i < Q; ++i) {
    std::cin >> t >> d;
    for (int j = 0; j < N; j++) {
      if (S[j] == t) {
        if (g[j] != 0) {
          if (d == 'R') {
            temp = g[j];
            g[j] = 0;
            g[j + 1] += temp;
            if (j + 1 == N) ans -= temp;
          } else {
            temp = g[j];
            g[j] = 0;
            if (j != 0)
              g[j - 1] += temp;
            else
              ans -= temp;
          }
        }
      }
    }
  }
  std::cout << ans << std::endl;
}
