#!/usr/bin/env python3
import sys
from collections import defaultdict


def solve(N: int, Q: int, s: str, t: "List[str]", d: "List[str]"):
    guide = defaultdict(list)
    for i in range(N):
        guide[s[i]] += [i]
    pos = [1]*N

    for i in range(Q):
        direc = 1 if d[i] == 'R' else -1
        copied = guide[t[i]].copy()
        guide[t[i]] = []
        for j in copied:
            pos[j] -= 1
            if 0 <= j + direc and j + direc < N:
                pos[j+direc] += 1
                guide[s[j+direc]] += [j+direc]
                # print("here", s[j+direc])
        # print(pos)
        # print(guide)
    print(sum(pos))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    s = next(tokens)  # type: str
    t = [str()] * (Q)  # type: "List[str]"
    d = [str()] * (Q)  # type: "List[str]"
    for i in range(Q):
        t[i] = next(tokens)
        d[i] = next(tokens)
    solve(N, Q, s, t, d)


if __name__ == '__main__':
    main()
