N,Q=input().split()
N=int(N)
Q=int(Q)
s=input()
t=['']*Q
d=['']*Q
for i in range(Q):
    t[i],d[i]=input().split()

#%%

    
t.reverse()
d.reverse()

golem=set()
count=set()

for i in range(Q):
    tmp=set()
    
    if d[i]=='R':
        for gtmp in golem-count-set([1]):
            if (gtmp-1 not in golem):
                if s[gtmp-1]==t[i]:
                    tmp.add(gtmp-1)
                    count.add(gtmp)
    else:
        for gtmp in golem-count-set([N-1]):
            if  (gtmp+1 not in golem):
                if s[gtmp+1]==t[i]:
                    tmp.add(gtmp+1)
                    count.add(gtmp)

    golem=golem.union(tmp)
    if t[i]==s[0] and d[i]=='L':
        golem.add(0)
    elif t[i]==s[-1] and d[i]=='R':
        golem.add(N-1)

        
print(N-len(golem))
