n,q=map(int, input().split())
s=input()
spell=[]
alp=[[]for _ in range(26)]
for _ in range(q):
  spell.append(input().split())

for i in range(len(s)):
  alp[ord(s[i])-ord('A')].append(i)

masu=[1]*n
ans=0

for si in spell:
  if si[1]=='R':
    index=ord(si[0])-ord('A')
    for mi in alp[index]:
      if mi==n-1:
        ans+=masu[n-1]
        masu[n-1]=0
      else:
        masu[mi+1]+=masu[mi]
        masu[mi]=0
  if si[1]=='L':
    index=ord(si[0])-ord('A')
    for mi in alp[index]:
      if mi==0:
        ans+=masu[0]
        masu[0]=0
      else:
        masu[mi-1]+=masu[mi]
        masu[mi]=0

print(n-ans)