a,b=map(int,input().split())
area=[0]+list(input())+[0]

magic=[]
status=[1]*(a+2)
for x in range(b):
    magic.append(list(input().split()))

for y in magic:
    target=[i for i, x in enumerate(area) if x == y[0]]
    if y[1]=="L":
        for z in target:
            if z<a+1:
                status[z-1]+=status[z]
                status[z]=0
    if y[1]=="R":
        for z in target:
            if z>0:
                status[z+1]+=status[z]
                status[z]=0

del status[0]
del status[-1]
print(sum(status))
