n, q = map(int, input().split())
listS = list(input())
hidariA = listS[0]
hidariM = "L"
migiA = listS[len(listS)-1]
migiM= "R"
flagH=0
flagM=0

index2=0
moveL=[]#alpha, move
while index2 < q:
    alpha, move = map(str, input().split())
    moveL.append([alpha, move])
    index2+=1

index3=0
delS=0
while index3 < len(moveL):
    if moveL[index3][0] == hidariA and moveL[index3][1]== hidariM:
        moveL[index3][0]=0
        if flagH ==0:
            delS+=1
            flagH=1
        index4=index3
        index5=1
        while index4 > -1:
            if moveL[index4][0] == listS[index5] and moveL[index4][1]== hidariM:
                delS+=1
                moveL[index4][0]=0
                index5+=1
            index4-=1
    elif moveL[index3][0] == migiA and moveL[index3][1] == migiM:
        moveL[index3][0]=0
        if flagM == 0:
            delS+=1
            flagM=1
        index4=index3
        index5=len(listS)-2
        while index4 > -1:
            if moveL[index4][0] == listS[index5] and moveL[index4][1] == migiM:
                delS += 1
                moveL[index4][0] = 0
                index5 -= 1
            index4 -= 1
    index3+=1
print(len(listS)-delS)
