n,q=map(int,input().split())
s=list(input())
alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
dic={alpha[i]:[] for i in range(26)}
for i in range(n):
    dic[s[i]].append(i+1)
range_dic={alpha[i]:["yet","yet",0] for i in range(26)}
#ゴーレムのmin,とmaxの横幅のとりうる値を文字ごとにとる.一番右はパラーメーター
for i in range(q):
    K=list(input().split())
    x,y=K[0],K[1]
    if K[1]=="R":
        range_dic[x][2]+=1
    elif K[1]=="L":
        range_dic[x][2]-=1      
    if True: 
        if range_dic[x][0]=="yet":
            range_dic[x][0]=range_dic[x][2]
            range_dic[x][1]=range_dic[x][2]
        elif range_dic[x][0]!="yet":
            range_dic[x][0]=min(range_dic[x][0],range_dic[x][2])
            range_dic[x][1]=max(range_dic[x][1],range_dic[x][2])
ans=0
for i in range(26):
    if range_dic[alpha[i]][0]=="yet":
        ans+=len(dic[alpha[i]])
    else:
        for num in dic[alpha[i]]:
            if 1<= range_dic[x][0]+num and range_dic[x][1]+num<=n:
                ans+=1
               
print(ans)