#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  char input[N];
  scanf("%s", input);
  pair<char, int> masu[N];
  for (int j = 0; j < N; ++j) {
    masu[j].first = input[j];
    masu[j].second = 1;
  }
  char sousa_moji;
  char sousa_houkou;
  int otita_yatu = 0;
  int tmp;
  for (int i = 0; i < Q; ++i) {
    cin >> sousa_moji >> sousa_houkou;
    if (sousa_houkou == 'L') {
      for (int j = 0; j < N; ++j) {
        if (masu[j].first == sousa_moji) {
          if (j - 1 >= 0) {
            masu[j - 1].second += masu[j].second;
            masu[j].second = 0;
          } else {
            otita_yatu += masu[j].second;
            masu[j].second = 0;
          }
        }
      }
    } else {
      for (int j = N - 1; j >= 0; --j) {
        if (masu[j].first == sousa_moji) {
          if (j <= N - 2) {
            masu[j + 1].second += masu[j].second;
            masu[j].second = 0;
          } else {
            otita_yatu += masu[j].second;
            masu[j].second = 0;
          }
        }
      }
    }
  }
  cout << N - otita_yatu;
}
