N, Q = list(map(int, input().split()))
S = input()
spell = [list(input().split()) for i in range(Q)]

D = {}
for i, s in enumerate(S):
    if s in D:
        D[s].append(i)
    else:
        D[s] = [i]

G = [1 for _ in range(N)]
loss = 0
for sp in spell:
    if sp[0] in D:
        for d in D[sp[0]]:
            if sp[1] == 'L':
                if d != 0:
                    G[d-1] += G[d]
                else:
                    loss += G[d]
                G[d] = 0
            elif sp[1] == 'R':
                if d != (N-1):
                    G[d+1] += G[d]
                else:
                    loss += G[d]
                G[d] = 0

print(N - loss)
