from collections import defaultdict

N,Q=[int(x) for x in input().split()]
S=input()
A=defaultdict(list)
B=[1 for x in range(N)]
for i in range(N):
    A[S[i]].append(i)
killed=0
for q in range(Q):
    a,b=input().split()
    tmp=[]
    if b=="R":
        d=1
    else:
        d=-1
    for k in A[a]:
        if (k==0 and d==-1) or (k==N-1 and d==1):
            killed+=B[k]
        elif B[k]!=0:
            tmp.append([k,B[k],d])
        B[k]=0
    for t in tmp:
        B[t[0]+t[2]]+=t[1]
print(N-killed)