n,q=map(int,input().split(" "))
s=input()
go=[1 for i in range(n)]
for i in range(q):
  t,d=input().split(" ")
  a=[j for j,i in enumerate(s) if i==t]
  for j in a:
    if d=="L":
      if j!=0:
        go[j-1]+=go[j]
        go[j]=0
      else:
        go[0]=0
    else:
      if j!=n-1:
        go[j+1]+=go[j]
        go[j]=0
      else:
        go[n-1]=0
counter=0
for i in go:
  counter+=i
print(counter)