n,q=map(int,input().split())
s=input()
#A65

mm=[1for i in range(n)]
m=[[]for i in range(26)]
for i in range(len(s)):
  m[ord(s[i])-65]+=[i]

for _ in range(q):
  t,d=input().split()
  t=ord(t)-65
  if d=="L":
    for i in m[t]:
      if i==0:
        mm[0]=0
      else:
        mm[i-1]+=mm[i]
        mm[i]=0
  if d=="R":
    for i in m[t]:
      if i==n-1:
        mm[n-1]=0
      else:
        mm[i+1]+=mm[i]
        mm[i]=0

print(sum(mm))