N, Q = map(int, input().split())
S = input()
char_set = set(S)
dct = {}
for char in char_set:
    indices = [i for i, x in enumerate(S) if x == char]
    dct[char] = indices
res = [1 for e in range(N)]
for _ in range(Q):
  target, direction = input().split()
  if target not in dct:
    continue
  index_lst = dct[target]
  for i in index_lst:
    # move all
    initial = res.copy()
    res[i] = 0
    try:
      if direction == 'R':
        res[i+1] = initial[i+1] + initial[i]
      elif direction == 'L' and i-1 >= 0:
        res[i-1] = initial[i-1] + initial[i]
    except:
        pass
print(sum(res))