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()


#N=10
#Q=15
#s='SNCZWRCEWB'
#t=['B','R','E','W','Z','S','Q','W','B','C','A','N','E','Z','S']
#d=['R','R','R','R','L','R','L','L','R','L','L','L','R','L','L']

    
t.reverse()
d.reverse()

golem=set()

for i in range(Q):
    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)
    else:
        tmp=set()
        for gtmp in golem:
            if gtmp>1:
                if s[gtmp-1]==t[i] and d[i]=='R':
                    tmp.add(gtmp-1)
            if gtmp<N-1:
                if s[gtmp+1]==t[i] and d[i]=='L':
                    tmp.add(gtmp+1)
        golem=golem.union(tmp)
        
print(N-len(golem))