n,q=map(int,input().split())
s=list(input())
s1=[1 for i in range(n)]
t=[0 for i in range(q)]
d=[0 for i in range(q)]
for i in range(q):
    t[i],d[i]=input().split()
for i in range(q):#回数
    if d[i]=="R":
        for j in range(n)[::-1]:#マス番号
            if t[i]==s[j]:
                if j==(n-1):
                    s1[j]=0
                else:
                    s1[j+1]=s1[j+1]+s1[j]
                    s1[j]=0
    else:
        for j in range(n):
            if t[i]==s[j]:
                if j==0:
                    s1[j]=0
                else:
                    s1[j-1]=s1[j-1]+s1[j]
                    s1[j]=0
count=0
for i in range(n):
    count=count+s1[i]
print(count)