import sys

input = sys.stdin.readline

n, q = map(int, input().split(" "))

s = input()

letterPlace = {}

for i, letter in enumerate(list(s)):
  if letter in letterPlace:
    letterPlace[letter].append(i)
  else:
    letterPlace[letter] = [i]
    
# print(letterPlace)

golems = [1] * n

for _ in range(q):
  spell = input().split(" ")
  if spell[0] not in letterPlace:
    continue
    
  if spell[1] == "L":
    for place in letterPlace[spell[0]]:
      if place == 0:
        golems[0] = 0
      else:
        golems[place - 1] += golems[place]
        golems[place] = 0
  else:
    for place in reversed(letterPlace[spell[0]]):
      if place == n-1:
        golems[n-1] =0
      else:
        golems[place + 1] += golems[place]
        golems[place] = 0

print(sum(golems))