n, q = list(map(int, input().split()))
s = list(input())
spells = []
for i in range(q):
  spells.append(input().split(" "))

gorems = []
for i in range(len(s)):
  gorems.append(i)

for spell in spells:
  for i in range(len(gorems)):
    if gorems[i] >= 0 and gorems[i] <= len(s) - 1:
      if s[gorems[i]] == spell[0]:
        if spell[1] == "L":
          gorems[i] -= 1
        else :
          gorems[i] += 1

print(len(list(filter(lambda x: x >=0 and x <= len(s)-1, gorems))))