import sys
N, Q = sys.stdin.readline().strip().split()
N = int(N)
Q = int(Q)

# タイルマップ(※1スタート)
s0 = list(sys.stdin.readline().strip())
s = {}
for i, x in enumerate(s0):
  # print(i)
  # print(x)
  s[x] = s.get(x, [])
  s[x].append(i+1)
s0 = []

# 命令
tds = sys.stdin.readlines()
tds = [x.strip().split() for x in tds]

# ゴーレムマップ
g = [1] * (N+2)
g[0] = 0
g[N+1] = 0

# print(s)
# print(g)

for k, command in enumerate(tds):
  # print(command)
  patch = {}
  targets = s.get(command[0], [])
  for x in targets:
    patch[x] = patch.get(x, 0) -g[x]
    if command[1] == "L":
      patch[x-1] = patch.get(x-1, 0) + g[x]
    else:
      patch[x+1] = patch.get(x+1, 0) + g[x]
  for k, v in patch.items():
    g[k] = g[k] + v
  g[0] = 0
  g[N+1] = 0
  # print(g)

print(sum(g))
# print(tds)
# print(g)
# print(s)