N, Q = map(int, input().split())
L = input()
G = {}
for i in range(1,N+1):
  g = L[i-1]
  if g in G.keys():
    G[g].append(i)
  else:
    G[g] = [i]

for i in range(Q):
  g, shift = input().split()
  shift = -1 if shift == "L" else 1
  if g in G.keys():
    for j in range(len(G[g])):
      if 0<G[g][j]:
        G[g][j] += shift
        if N<G[g][j]:
          G[g][j] = 0

count = 0
for gs in G.values():
  for g in gs:
    if 0<g: count+=1

print(count)
