N,Q = map(int, input().split())
s = input()
length=len(s)
gorem=[1]*length
t = [input().split(" ") for i in range(Q)]
for i in t:
    tmp=[j for j in range(length) if s[j]==i[0]]
    if i[1]=='L':
        for _ in tmp:
            if _ == 0:
                gorem[_]=0
            else:
                gorem[_-1]+=gorem[_]
                gorem[_]-=gorem[_]
    else:
        for _ in tmp:
            if _ == length-1:
                gorem[_]=0
               
            else:
                gorem[_+1]+=gorem[_]
                gorem[_]-=gorem[_]
                
print(sum(gorem))