N, Q = map(int, input().split())
s = input()
t_list, d_list = [], []
for _ in range(Q):
    l, r = input().split()
    t_list.append(l)
    d_list.append(r)

from collections import defaultdict
loc_dict = defaultdict(list)
for moji in s:
    if moji in loc_dict.keys():
        continue
    for idx, moji_ in enumerate(s):
        if moji == moji_:
            loc_dict[moji].append(idx)
            
import numpy as np
gorems = np.ones((len(s)+2)) 
gorems[0] = 0
gorems[-1] = 0
original_num = len(s)

for t_i, d_i in zip(t_list, d_list):
    target_loc_list = np.array(loc_dict[t_i])+1
    save = gorems[target_loc_list][:]
    if d_i == "L":
        gorems[target_loc_list-1] += gorems[target_loc_list]
        gorems[target_loc_list] -= save
    else:
        gorems[target_loc_list+1] += gorems[target_loc_list]
        gorems[target_loc_list] -= save
print(int(original_num - gorems[0] - gorems[-1]))
# %time