from collections import defaultdict
from sys import stdin

def main():
    N, Q = map(int, input().split())
    S = input()
    TD = [tuple(input().split()) for _ in [0] * Q]

    golem = [1] * N
    masu = defaultdict(list)
    for i, s in enumerate(S):
        masu[s].append(i)

    for t, d in TD:
        for i in masu[t]:
            if golem[i] == 0:
                continue
            if d == 'L' and i > 0:
                golem[i-1] += golem[i]
            elif d == 'R' and i < N - 1:
                golem[i+1] += golem[i]
            golem[i] = 0
    print(sum(golem))

input = lambda: stdin.readline().rstrip()
main()
