#include <bits/stdc++.h>
int main() {
  int N, Q;
  std::cin >> N >> Q;
  std::string s;
  std::cin >> s;
  std::vector<int> fields(N, 1);
  int ans = N;
  for (int i = 0; i < Q; ++i) {
    char t, d;
    std::cin >> t >> d;
    switch (d) {
      case 'L':
        for (int i = 0; i < N; ++i) {
          if (s[i] != t) continue;
          if (i == 0)
            ans -= fields[i];
          else
            fields[i - 1] += fields[i];
          fields[i] = 0;
        }
        break;
      case 'R':
        for (int i = N - 1; i >= 0; --i) {
          if (s[i] != t) continue;
          if (i == N - 1)
            ans -= fields[i];
          else
            fields[i + 1] += fields[i];
          fields[i] = 0;
        }
        break;
    }
  }
  std::cout << ans << std::endl;
}
