N,Q=map(int,input().split())
s=input()
gorem=[1 for i in range(N+2)]
dic={"R":1,"L":-1}

t={}
for magic in range(Q):
    ti,di=input().split()
    if ti in t:
        pos=t[ti]
    else:
        pos=[i+1 for i,x in enumerate(s) if x==ti]
        t.update([(ti,pos)])
    for p in pos:
        numG=gorem[p]
        if numG==0:
            continue
        gorem[p]=0
        gorem[p+dic[di]]+=numG
    
print(sum(gorem[1:-1]))