N, Q = [int(x) for x in input().split()]
S = input()

SD = {}
for i in range(len(S)):
    a = SD.get(S[i], set())
    a.add(i)
    SD[S[i]] = a

G = [1] * N

D = {}
rmg = 0
for _ in range(Q):
    t, d = input().split()
    # print(G)

    if SD.get(t,0) == 0:
        continue

    if d == "L":
        for i in SD[t]:
            if i == 0:
                rmg += G[i]
                G[i] = 0
            else:
                G[i - 1] += G[i]
                G[i] = 0
    else:
        for i in SD[t]:
            if i == N - 1:
                rmg += G[i]
                G[i] = 0
            else:
                G[i + 1] += G[i]
                G[i] = 0

# print(G)

print(N - rmg)
