N,Q = map(int,input().split())
s = input()
g = [1]*N
table = {}
for i in range(N):
  key = s[i]
  if key in table:
    e = table[key]
    e.append(i)
    table[key] = e
  else:
    new = [i]
    table[key] = new

delete = 0
for i in range(Q):
  t,lr = map(str,input().split())
  if t in table:
    g_num = 0
    for index in table[t]:
      if g[index] > 0:
        if g_num > 0 and ((lr == 'R' and  index != 0 and s[index - 1] == t) or (lr == 'L' and index != N-1 and s[index + 1] == t)):
          v = g_num
          g_num = g[index] - g_num
          g[index] = v
        else:
          g_num = g[index]
          g[index] = 0
        if lr == 'R' and index != N-1:
          g[index + 1] += g_num
        elif lr == 'L' and index != 0:
          g[index - 1] += g_num
        else:
          delete += g_num
print(N - delete)