N,Q = map(int, input().split())
s = input()
gorem = []
for _ in range(len(s)):
    gorem.append(1)
t = [input().split(" ") for i in range(Q)]

for i in t:
    tmp = []
    for j in range(len(s)):
        if s[j]==i[0]:
            tmp.append(j)
    if i[1]=='L':
        for _ in tmp:
            if _ == 0:
                gorem[_]=0
                #print(gorem)
            else:
                #gorem[_]-=1
                gorem[_-1]+=gorem[_]
                gorem[_]-=gorem[_]
                #gorem[_-1]+=1
                
                #print(gorem)
    else:
        for _ in tmp:
            if _ == len(s)-1:
                gorem[_]=0
               
            else:
                #gorem[_]-=1
                #gorem[_+1]+=1
                gorem[_+1]+=gorem[_]
                gorem[_]-=gorem[_]
                
                
        
result=0
for i in gorem:
    result+=i
print(result)
                

    
    