#マスの長さ，呪文の回数
N,Q = map(int, input().split())
#ABC
square = list(str(input()))
#ゴーレムの数
num_list = [1]*N
td = [input().split() for _ in range(Q)]
for t,d in td:
  index = [i for i, x in enumerate(square) if x == t]
  for j in index:
    if square[j] == t and num_list[j] != 0:
      move = num_list[j]
      num_list[j] = 0
      if j < N-1 and d == 'R':
        num_list[j+1] += move
      elif 0 < j and d == 'L':
        num_list[j-1] += move
print(sum(num_list))