#include <bits/stdc++.h>
using namespace std;
class UnionFind {
 public:
  vector<int> Parent;
  UnionFind(int N) { Parent = vector<int>(N, -1); }
  int root(int A) {
    if (Parent[A] < 0) return A;
    return Parent[A] = root(Parent[A]);
  }
  int size(int A) { return -Parent[root(A)]; }
  bool connect(int A, int B) {
    A = root(A);
    B = root(B);
    if (A == B) {
      return false;
    }
    if (size(A) < size(B)) swap(A, B);
    Parent[A] += Parent[B];
    Parent[B] = A;
    return true;
  }
};
long long GCD(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
long long extGCD(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long d = extGCD(b, a % b, y, x);
  y -= a / b * x;
  return d;
}
bool check(long long int a, long long int b) { return a > b; }
int main() {
  int n, q;
  string str;
  cin >> n >> q;
  cin >> str;
  vector<int> s(n);
  for (int i = 0; i < n; i++) {
    s[i] = str[i] - 'A';
  }
  vector<int> a(q);
  vector<int> b(q);
  char ss, t;
  for (int i = 0; i < q; i++) {
    cin >> ss >> t;
    a[i] = (int)(ss - 'A');
    if (t == 'L') {
      b[i] = 0;
    } else {
      b[i] = 1;
    }
  }
  vector<int> left(n, 0);
  int lcnt = 0;
  for (int i = q - 1; 0 <= i; i--) {
    if (lcnt == 0) {
      if (a[i] == s[0] && b[i] == 0) {
        left[0] = 1;
        lcnt++;
      }
    } else {
      for (int j = 0; j < n; j++) {
        if (left[j] == 1) {
          if (j != 0) {
            if (a[i] == s[j - 1] && b[i] == 1) {
              left[j - 1] = 1;
              lcnt++;
            }
          }
          if (j != n - 1) {
            if (a[i] == s[j + 1] && b[i] == 0) {
              left[j + 1] = 1;
              lcnt++;
            }
          }
          if (a[i] == s[j]) {
            if (b[i] == 0) {
              if (j != 0) {
                left[j] = left[j - 1];
              }
            } else {
              if (j != n - 1) {
                left[j] = left[j + 1];
              } else {
                left[j] = 0;
              }
            }
            if (left[j] == 0) {
              lcnt--;
            }
          }
        }
      }
    }
  }
  vector<int> right(n, 0);
  int rcnt = 0;
  for (int i = q - 1; 0 <= i; i--) {
    if (rcnt == 0) {
      if (a[i] == s[n - 1] && b[i] == 1) {
        right[n - 1] = 1;
        rcnt = 1;
      }
    } else {
      for (int j = 0; j < n; j++) {
        if (right[j] == 1) {
          if (j != 0) {
            if (a[i] == s[j - 1] && b[i] == 1) {
              right[j - 1] = 1;
            }
          }
          if (j != n - 1) {
            if (a[i] == s[j + 1] && b[i] == 0) {
              right[j + 1] = 1;
            }
          }
          if (a[i] == s[j]) {
            if (b[i] == 0) {
              if (j != 0) {
                right[j] = right[j - 1];
              } else {
                right[j] = 0;
              }
            } else {
              if (j != n - 1) {
                right[j] = right[j + 1];
              }
            }
            if (right[j] == 0) {
              rcnt--;
            }
          }
        }
      }
    }
  }
  int ans = n;
  for (int i = 0; i < n; i++) {
    ans -= left[i];
    ans -= right[i];
  }
  cout << ans << endl;
  return 0;
}
