N,Q = list(map(int,input().split()))
s = input()
td = []
for i in range(Q):
    td.append(input().split())

gol = [1]*N

for i in td:
    if i[1] == 'L':
        for j in range(N):
            if s[j] == i[0]:
                if j != 0:
                    gol[j-1] += gol[j]
                gol[j] = 0
            
    else:
        for j in range(N-1,-1,-1):
            if s[j] == i[0]:
                if j != N-1:
                    gol[j+1] += gol[j]
                gol[j] = 0


sum = 0
for i in gol:
    sum += i
print(sum)