import numpy as np
N, Q = list(map(int, input().split()))
S = str(input())
s_array = []
P_list = []
D_list = []

g_num = dict() # ゴーレムの数

for i in range(N):
  s_array.append(S[i])
  g_num[i] = 1

s_array = np.array(s_array)

for q in range(Q):
  p, d = list(map(str, input().split()))
  rm_idx = np.where(s_array == p)[0]
#  rm_idx_pos = []
    
#  print('g_num {}'.format(g_num))
#  rm_idx_pos = np.array(rm_idx_pos)
  
  if d == 'R':
    add_idx = rm_idx[(rm_idx < N - 1) & (rm_idx >= 0)]
    add_idx += 1
#    print('R : add {}'.format(add_idx))
    
    g_num[N-1] = 0
    
    for idx in reversed(add_idx):
      g_num[idx] += g_num[idx-1]
      g_num[idx-1] = 0
#    print('res : {}'.format(g_num))
  
  else:
    add_idx = rm_idx[(rm_idx < N) & (rm_idx > 0)]
    add_idx -= 1
#    print('L : add {}'.format(add_idx))
    
    g_num[0] = 0
    
    for idx in add_idx:
      g_num[idx] += g_num[idx + 1]
      g_num[idx+1] = 0
#    print('res : {}'.format(g_num))

  P_list.append(p)
  D_list.append(d)

x = 0
for y in list(g_num.keys()):
  x += g_num[y]
  
print(x)