n,q=map(int,input().split());s=input();m=[[]];b=[1]*n
for i in range(n):
  if s[i] in m[0]:m[m[0].index(s[i])+1].append(i)
  else:
    m[0].append(s[i])
    m.append([i])
for i in range(q):
  t,d=input().split()
  if t in m[0]:
    w=m[0].index(t)+1
    if d=="L":
      for j in m[w]:
        if 0<j:b[j-1]+=b[j]
        b[j]=0
    else:
      for j in m[w][::-1]:
        if j<n-1:b[j+1]+=b[j]
        b[j]=0
print(sum(b))