import numpy as np
N, Q = map(int, input().split())
s=input()
goreme= np.array([1]*N)
dic={}
pre_ans=0
for i,moji in enumerate(s):#文字index関係整理
    dic.setdefault(moji,[])
    dic[moji].append(i)
for k in range(Q):
    jumon=input()
    #if jumon[0] in dic.keys():
    move= np.array([0]*N)
    if jumon[-1]=='R':
        for index in dic[jumon[0]]:
            if goreme[index]!=0:
                if index==N-1:
                    move[index]-=goreme[index]
                    pre_ans+=goreme[index]
                else:
                    move[index]-=goreme[index]
                    move[index+1]+=goreme[index]
    else:
        for index in dic[jumon[0]]:
            if goreme[index]!=0:
                if index==0:
                    move[index]-=goreme[index]
                    pre_ans+=goreme[index]
                else:
                    move[index]-=goreme[index]
                    move[index-1]+=goreme[index]     
    goreme+=move
    #print(goreme)
print(N-pre_ans)