n,q = list(map(int,input().split()))
s = list(input())
t = [0]*q
d = [0]*q
m ={} 
golem = [1 for i in range(0,n)]

for i in range(0,n):
    if s[i] in m:
        m[s[i]].append(i)
    else:
        m[s[i]] = list([i])

for i in range(0,q):
    t[i],d[i]= list(input().split())
    if d[i] == "L":
        p = -1
    else:
        p = 1
    if t[i] not in m:
        continue
    for j in m[t[i]]:
        if j + p < 0:
            golem[j] = 0
        elif j + p > n-1:
            golem[j] = 0
        else:
            golem[j+p] += golem[j]
            golem[j] = 0
    
print(sum(golem))