
N,Q = map(int,input().split())
S = input()

A=[[] for _ in range(26)]
for i in range(len(S)):
    A[int(ord(S[i]))-65].append(i)
#print(A)
g = [1]*(N)
#print(g)
for i in range(Q):
    t,d = input().split()
    for h in A[ord(t)-65]:
        if h == 0 and d=='L':
            g[0] = 0
        if h == N-1 and d=='R':
            g[N-1] = 0
        if h<N-1 and d=='R':
            tmp = g[h]
            g[h] = 0
            g[h+1] += tmp
        if h>0 and d=='L':
            tmp = g[h]
            g[h] = 0
            g[h-1] += tmp
sum = 0
for i in range(N):
    sum += g[i]
print(sum)