export class Main {
  static main(input): string {
    const tmp: string[] = input.split("\n");
    const [n, q]: number[] = tmp[0].split(" ").map(Number);
    const sList: string[] = tmp[1].split("");
    const indexMap: {[key: string]: number[]} = {};
    const countList: number[] = [];
    for (let i = 0; i < n; i++) {
      if (indexMap[sList[i]] == null) {
        indexMap[sList[i]] = [];
      }
      indexMap[sList[i]].push(i);
      countList.push(1);
    }
    let result: number = 0;
    for (let i = 2; i < q + 2; i++) {
      const [t, d]: string[] = tmp[i].split(" ");
      if (indexMap[t] == null) {
        continue;
      }
      indexMap[t].forEach(index => {
        switch (d) {
          case "L":
            if (index == 0) {
              result += countList[index];
            } else {
              countList[index - 1] += countList[index];
            }
            break;
          case "R":
            if (index == n - 1) {
              result += countList[index];
            } else {
              countList[index + 1] += countList[index];
            }
        }
        countList[index] = 0;
      });
    }
    return `${n - result}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));