import copy
N, Q = map(int, input().split(" "))
s = input()
g = [1] * N
s_set = set(s)
s_index = []

for s_set_index in s_set:
  s_index.append([s_set_index, [i for i, x in enumerate(list(s)) if x == s_set_index]])

for i in range(Q):
  q = input().split(" ")
  try:
    addr_word_s_index = list(s_set).index(q[0])
    old_g = copy.copy(g)
    for now_s in s_index[addr_word_s_index][1]:
      if now_s == 0:
        if q[1] == "L":
          g[0] -= old_g[0]
        else:
          g[1] += old_g[0]
          g[0] -= old_g[0]
      elif now_s == N - 1:
        if q[1] == "R":
          g[N-1] -= old_g[N-1]
        else:
          g[N-2] += old_g[N-1]
          g[N-1] -= old_g[N-1]
      else:
        if q[1] == "R":
          g[now_s+1] += old_g[now_s]
          g[now_s] -= old_g[now_s]
        else:
          g[now_s-1] += old_g[now_s]
          g[now_s] -= old_g[now_s]
  except Exception as e:
    continue
  finally:
    tom = "No1"
print(sum(g))
