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

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