N, Q = map(int, input().split())
s = input()

ngolem = [1 for i in range(N)]

for i in range(Q):
  t, d = input().split()
  di = 1 if d == "R" else -1
  idxes = [i for i, x in enumerate(s) if x == t]

  for i_ in idxes:
    if i_ == 0 and di == -1:
      ngolem[0] = 0
    if i_ == N-1 and di == 1:
      ngolem[-1] = 0
    else:
      ngolem[i_+di] += ngolem[i_]
      ngolem[i_] = 0
  
  #print(ngolem)
  #print(idxes)
  #print(t, d)

print(sum(ngolem))