import copy
import sys

n, q = map(int, sys.stdin.readline().split())

s = input()

letterPlace = {}

golemGroup = {}

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

#print(golemGroup)

move = {
  "R" : 1,
  "L" : -1
}

for _ in range(q):
  spell = sys.stdin.readline().split()
  if spell[0] not in letterPlace:
    continue
  places = letterPlace[spell[0]]
  nextGroup = copy.copy(golemGroup)
  for place in places:
    if place == 0 and spell[1] == "L":
      del(nextGroup[place])
    elif place == n-1 and spell[1] == "R":
      del(nextGroup[place])
    else:
      if place not in golemGroup:
        continue
      if place + move[spell[1]] in golemGroup:
        nextGroup[place + move[spell[1]]] += golemGroup[place]
        del(nextGroup[place])
      else:
        nextGroup[place + move[spell[1]]] = golemGroup[place]
        del(nextGroup[place])
    golemGroup = copy.copy(nextGroup)
    #print(golemGroup)

out = 0
for v in golemGroup.values():
  out += len(v)

print(out)