n,q = map(int, input().split())
s = input()
listA = [list(map(str, input().split())) for i in range(q)]
listB =[]
for l in range(n):
    listB.append(1)
def sak(listC, y):
    if y==0:
        listC[0]=0
    else:
        listC[y-1]=listC[y-1]+listC[y]
        listC[y]=0
def sakana(listD, z):
    if z==n-1 :
        listD[n-1]=0
    else :
        listD[z+1]=listD[z+1]+listD[z]
        listD[z]=0
for j in range(q):
    for k in range(n):
        if listA[j][1]=="L" and s[k]==listA[j][0] :
            sak(listB, k)
        elif listA[j][1]=="R" and s[n-1-k]==listA[j][0] :
            sakana(listB, n-1-k)
print(sum(listB))