N,Q=map(int,input().split())
S=input()
ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ABCD={}
for i,l in enumerate(ABC):
    ABCD[l]=i
    
memo=[[] for _ in range(26)]
for i,s in enumerate(S):
    memo[ABCD[s]].append(i)
state=[1]*N
exist=N

for _ in range(Q):
    t,d=input().split()
    
    if d=='L':
        tmp=memo[ABCD[t]][:]
        if tmp==[]: continue
        if tmp[0]==0:
            exist-=state[0]
            state[0]=0
            del tmp[0]
        for m in tmp:
            state[m-1]+=state[m]
            state[m]=0
    
    else:
        tmp=memo[ABCD[t]][::-1]
        if tmp==[]: continue
        if tmp[0]==N-1:
            exist-=state[-1]
            state[-1]=0
            del tmp[0]
        for m in tmp:
            state[m+1]+=state[m]
            state[m]=0
print(exist)