from collections import defaultdict
N,Q=map(int,input().split())
dic=defaultdict(list)
s=input()
for i in range(N):
  dic[s[i]].append(i)
ls=list(s)
L=[1 for i in range(N)]
M=0
for i in range(Q):
  t,d=input().split()
  if d=="L":
    
    for k in dic[t]:
      if k==0:
        M+=L[0]
        L[0]=0
      else:
        L[k-1]+=L[k]
        L[k]=0
  else:
    
    for k in reversed(dic[t]):
      if k==N-1:
        M+=L[N-1]
        L[N-1]=0
      else:
        L[k+1]+=L[k]
        L[k]=0
print(N-M)