let indeies: { [k: string]: number[] } = {};

function main(input) {
    const tmp = input.split("\n");
    const [N, Q] = tmp[0].split(" ").map(v => parseInt(v));
    const s = tmp[1];
    const result = (new Array(N)).fill(1);
    const TDs = tmp.slice(2).map(v => v.split(" "));
    for (let i = 0; i < Q; i++) {
        const Is = getIndeies(s, TDs[i][0]);
        console.log(Is); // debug
        console.log(s); // debug
        console.log(TDs[i][0]); // debug
        for (let j = 0, l = Is.length; j < l; j++) {
            switch (TDs[i][1] as string) {
                case "L":
                    if (Is[j] === 0) {
                        result[Is[j]] = 0;
                    } else {
                        result[Is[j] - 1] += result[Is[j]];
                        result[Is[j]] = 0;
                    }
                    break;
                case "R":
                    if (Is[j] === N - 1) {
                        result[Is[j]] = 0;
                    } else {
                        result[Is[j] + 1] += result[Is[j]];
                        result[Is[j]] = 0;
                    }
                    break;
            }
        }
    }
    console.log(result); // debuga
    console.log(result.reduce((p, c) => (p + c)));
}

function getIndeies(arr: string, s: string): number[] {
    if (indeies[s]) { return indeies[s]; }
    const result: number[] = [];
    for (let i = 0, l = arr.length; i < l;) {
        i = arr.indexOf(s, i);
        if (i === -1) { break; }
        result.push(i);
        i++;
    }
    indeies[s] = result;
    return result;
}

main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
