n, q = list(map(int,input().split()))
s = input()
l = [input().split() for i in range(q)] #A L とか
miti = [1]*(n+2) #ますにいるゴーレムの数
kazu = {} #dict型 keyのマスの場所
for i in range(len(s)) :
    kazu.setdefault(s[i],[]).append(i+1)
for i in l :
    if i[0] in kazu :
        if i[1] == "L" :
            for j in kazu[i[0]] :
                miti[j-1] += miti[j]
                miti[j] = 0
        else :
            for j in kazu[i[0]][::-1] :
                miti[j+1] += miti[j]
                miti[j] = 0
        #print(miti)
print(sum(miti[1:-1]))
#print(miti)
#print(kazu)
