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


for i in range(26):
    answer[chr(ord("A") + i)] = []

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

    return count
  
for i in range(N):
    answer[S[i]].append(i)

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

print(remain)