mn,jn=map(int,input().split())
mm=input()
mi_mm={}
go=[1 for i in range(mn+2)]
for i in range(mn):
    mi_mm.setdefault(mm[i],[])
    mi_mm[mm[i]]+=[i+1]

for ji in range(jn):
    ju=input().split()
    nk=jn-ji
    if ju[0] in mm[:nk]+mm[-nk:]:
        if ju[1]=="L":
            for mi in mi_mm[ju[0]]:
                if nk+1<=mi<mn-nk-1:continue
                go[mi-1]+=go[mi]
                go[mi]=0
        else:
            for mi in mi_mm[ju[0]][::-1]:
                if nk+1 <= mi < mn - nk-1: continue
                go[mi +1] += go[mi]
                go[mi] = 0

print(sum(go[1:mn+1]))