N, Q = list(map(int, input().split()))
S = input()
M = [input().split() for _ in range(Q)] #Magic:[t, d]*Q

import numpy as np

_dict={}
for i, s in enumerate(S):
  #print(s)
  _dict.setdefault(s, []).append(i+1)
#print(_dict)

for k in _dict.keys():
  _dict[k] = np.array(_dict[k])



G = np.array([0] + [1]*N + [0])

for t,d in M:
  if t not in _dict:
    continue
    
  NextG = G.copy()
  if d=='L':
    NextG[_dict[t] -1] = NextG[_dict[t] -1] + G[_dict[t]]
    NextG[_dict[t]] = NextG[_dict[t]] - G[_dict[t]]
  else:
    NextG[_dict[t] +1] = NextG[_dict[t] +1] + G[_dict[t]]
    NextG[_dict[t]] = NextG[_dict[t]] - G[_dict[t]]
  G = NextG
  #print(t,d)
  #print('   '+' '.join([s for s in S]))
  #print(G)
    
print(G[1:-1].sum())
  


  