N, Q = (int(i) for i in input().split())  
s = input()
s="!"+s+"?"
spells = [input().split() for _ in range(Q)]

masu=[1]*(N+2)
for spell in spells:
   t=spell[0]
   d=spell[1]
   indexes = [i for i, x in enumerate(s) if x == t]
   if d=="R":
      for index in indexes:
         masu[index]+=masu[index-1]
         masu[index-1]=0
   else:
      for index in indexes:
         masu[index]+=masu[index+1]
         masu[index+1]=0

print(masu)
masu.pop(0)
masu.pop(N+1)
print(sum(masu))
