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 sakana(listC, y):
    if y==0:
        listC[0]=0
    elif y!=0:
        listC[y-1]=listC[y-1]+listC[y]
        listC[y]=0
        
def sakanasan(listD, z):
    if z==n-1 :
        listD[n-1]=0
    elif z!=n-1 :
        listD[z+1]=listD[z+1]+listD[z]
        listD[z]=0

for j in range(q):
    for k in range(n):
        if s[k]==listA[j][0] and listA[j][1]=="L":
            sakana(listB, k)
        elif s[n-1-k]==listA[j][0] and listA[j][1]=="R":
            sakanasan(listB, n-1-k)
print(sum(listB))