N,Q=map(int,input().split())
s=input()
gorem=[1 for i in range(N)]
ans=N
for i in range(Q):
    t,d=input().split()
    pos=[i for i,x in enumerate(s) if x==t]
    for p in pos:
        numOfG=gorem[p]
        if numOfG==0:
            continue

        if p==0:
            gorem[p]=0
            if d=="R":
                gorem[p+1]+=numOfG
            else:
                ans-=numOfG
            continue

        elif p==N-1:
            gorem[p]=0
            if d=="L":
                gorem[p-1]+=numOfG
            else:
                ans-=numOfG
            continue
            
        gorem[p]=0
        if d=="L":
            gorem[p-1]+=numOfG
        else:
            gorem[p+1]+=numOfG

print(ans)
        