N, Q = (int(x) for x in input().split())
S = input()  #  len:N
G = [1] * N
remain = N

def change(g, a, d, S):
    count = 0
    for i in range(len(S)):
        if S[i] == a:
            if d == "R":
                if i + 1 < len(S):
                    g[i+1] += g[i]
                    g[i] = 0
                elif i + 1 == len(S):
                    count += g[i]
                    g[i] = 0
            elif d == "L":
                if i - 1 > 0:
                    g[i-1] += g[i]
                    g[i] = 0
                elif i - 1 == 0:
                    count += g[i]
                    g[i] = 0

    return g, count

for i in range(Q):
    t, d = input().split()
    G, count = change(G, t, d, S)
    remain -= count

print(remain)