import sys

N, Q = map(int,input().split())
s = input().lower()
gorem = [1]*N
gorem2 = [1]*N

list =[[] for i in range(ord("z")-ord("a")+1)]

for i in range(len(s)):
    list[ord(s[i])-ord("a")].append(i)

for i in range(Q):
    t, d = input().split()
    if d == "R":
        for j in list[ord(t.lower())-ord("a")]:
            if j == N-1:
                gorem2[j] -= gorem[j]
            else:
                gorem2[j+1] += gorem[j]
                gorem2[j] -= gorem[j] 
                
    elif d == "L":
        for j in list[ord(t.lower())-ord("a")]:
            if j == 0:
                gorem2[j] -= gorem[j]
            else:
                gorem2[j-1] += gorem[j]
                gorem2[j] -= gorem[j]             
    gorem = gorem2
print(sum(gorem))