n, q = map(int, input().split())
listS = list(input())
listN=[1]*len(listS)
alphaL=[]
indexL=[]
index=0
while index < len(listS):
    if listS[index] in alphaL:
        taI = alphaL.index(listS[index])
        indexL[taI].append(index)
    else:
        alphaL.append(listS[index])
        indexL.append([index])
    index+=1

index2=0
delS=0
while index2 < q:
    alpha, move = map(str, input().split())
    if move == "R":
        plus=1
    else:
        plus=-1
    if alpha in alphaL:
        taI=alphaL.index(alpha)
        tIL=indexL[taI]
        for index in tIL:
            if index == 0 and plus==-1:
                delS+=listN[index]
                listN[index]=0
            elif index == len(listN)-1 and plus==1:
                delS+=listN[index]
                listN[index]=0
            else:
                listN[index+plus]+=listN[index]
                listN[index]=0
    index2+=1
print(len(listN)-delS)