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])

s_array = np.array(s_array)
g_num = np.ones(N)

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':
    org_idx = rm_idx
    add_idx = org_idx + 1
    add_idx = add_idx[(rm_idx < N - 1) & (rm_idx >= 0)]
#    print('R : add {}'.format(add_idx))
        
    adds = np.zeros(N)
    adds[add_idx] = g_num[org_idx]
    g_num[org_idx] = 0
    g_num[add_idx] += adds[add_idx]

#    print('res : {}'.format(g_num))
  
  else:
    org_idx = rm_idx
    add_idx = org_idx - 1
    add_idx = add_idx[(rm_idx < N) & (rm_idx > 0)]
    
#    print('L : add {}'.format(add_idx))

    
    adds = np.zeros(N)
    adds[add_idx] = g_num[org_idx]
    g_num[org_idx] = 0
    g_num[add_idx] += adds[add_idx]
#    print('res : {}'.format(g_num))

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

x = np.sum(g_num)  
print(x)