"use strict";
function Main(input) {
    let lines = input.split("\n");
    let NQ = lines.shift().trim().split(/\s/).map((v) => v - 0);
    let N = NQ[0], Q = NQ[1];
    let S = lines.shift().trim().split('');
    let s = new Array(N).fill(1);
    let TD = new Array(Q);
    for (let n = 0; n < Q; n++) {
        TD[n] = lines.shift().trim().split(/\s/);
    }
    for (let n = 0; n < Q; n++) {
        let ch = TD[n][0];
        let dir = TD[n][1];
        for (let m = 0; m < N; m++) {
            if (S[m] != ch) continue;
            let k = s[m]; s[m] = 0;
            if (dir == 'L' && m > 0) s[m-1] += k;
            if (dir == 'R' && m < N-1) s[m+1] += k;
        }
    }
    let ans = s.reduce((ac, v) => ac + v, 0);
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
