n,q = map(int,input().split())
s = list(input())
r = [1]*n
for que in range(q):
  t,d = input().split()
  if d == 'L':
    for i in range(n):
      if t == s[i] and i==0:
        r[0]=0
      elif t == s[i]:
        r[i-1]+=r[i]
        r[i]=0
  if d == 'R':
    for i in range(n):
      if t == s[i] and i==n-1:
        r[n-1]=0
      elif t == s[i] and r[i]!=0:
        r[i+1]+=r[i]
        r[i]=0     
print(sum(r))        