from sys import stdin
# import numpy as np
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
N, Q = [int(x) for x in stdin.readline().rstrip().split()]
S = stdin.readline().rstrip().split()[0]

G = [1 for _ in range(N)]

dict_S = {}
alpha = [chr(i) for i in range(65, 65+26)]
for a in alpha:
  dict_S[a] = [a==s for s in S]

for i in range(Q):
  t, d = [x for x in stdin.readline().rstrip().split()]
  is_G = [x>0 for x in G]
  g_idxs = [i for i, x in enumerate(is_G) if x == True]
  map_idxs = [i for i,x in enumerate(dict_S[t]) if x==True]
  move_idxs =[x for x in g_idxs if x in map_idxs]
  moving_gs = [G[i] for i in move_idxs]
  for i in move_idxs:
    G[i]=0
  if d=="R":
    d=1
  else:
    d=-1
  for g, idx in zip(moving_gs, move_idxs):
    idx=idx+d
    if idx>=0 and idx<N:
      G[idx] += g
print(sum(G))
