nq = input().split()
n = int(nq[0])
q = int(nq[1])
block_word = [""]
block_num = [""]
block_move = [""]
golem = n
s = input()
t = ""
d = ""

for word in s:
  block_word += [word]
  block_move += [0]
  block_num += [1]

for i in range(q):
  print(golem)
  td = input().split()
  t = td[0]
  d = td[1]
  for j in range(1, n+1):
    if t == block_word[j]:
      if j == n and d == "R":
        golem -= block_num[n]
        block_num[n] = 0
      elif j == 1 and d == "L":
        golem -= block_num[1]
        block_num[1] = 0
      else:
        if d == "R":
          block_move[j+1] = block_num[j]
          block_num[j] = 0
        if d == "L":
          block_move[j-1] = block_num[j]
          block_num[j] = 0
    else:
        j=j
  for k in range(1,n+1):
    block_num[k] += block_move[k]
  for i in range(1,n+1):
    block_move[i] = 0

print(golem)