n,q=map(int,input().split())
S=input()
s=[1]*n
for i in range(q):
  D=1
  t,d=input().split()
  if d=='L':
    D=-1
  else:
    D=1
  for j in range(n):
    if S[j]==t:
      s[j]-=1
      if j+D<n and j+D>=0: 
        s[j+D]+=1
print(sum(s))