n,q=map(int,input().split())
s=list(input())
g=[1 for i in range(n)]
l=[]
for i in range(q):
    l.append(list(input().split()))
for i in l:
    if i[1]=="L":
        for j in range(n):
            if s[j]==i[0]:
                if j==0:
                    g[j]=0
                else:
                    g[j-1]+=g[j]
                    g[j]=0
    else:
        for j in range(n):
            if s[n-j-1]==i[0]:
                if j==0:
                    g[n-1]=0
                else:
                    g[n-j]+=g[n-j-1]
                    g[n-j-1]=0
print(sum(g))