import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  int n, q;
  readf("%d %d\n", &n, &q);
  immutable s = readln.chomp;
  auto p = new int[](n);
  foreach (i; 0..n) {
    p[i] = i;
  }
  auto m = new int[][](100);
  foreach (i; 0..n) {
    m[s[i].to!int] ~= i;
  }

  auto p_prev = p.dup;

  foreach (_; 0..q) {
    auto a = readln.chomp.split.map!(to!char).array;
    immutable t = a[0].to!int;

    foreach (e; m[t]) {
      if (a[1] == 'R') {
        foreach (i; 0..n) {
          if (p_prev[i] != e) {
            continue;
          }
          p[i]++;
        }
      } else {
        foreach (i; 0..n) {
          if (p_prev[i] != e) {
            continue;
          }
          p[i]--;
        }
      }
    }
    p_prev = p.dup;
  }

  int cnt;
  foreach (i; 0..n) {
    if (p[i] < 0 || p[i] >= n) cnt++;
  }

  writeln(n - cnt);
}
