[N, Q] = list(map(int, input().split()))
s = input()
td_list = [input().split() for _ in range(Q)]

cell_dict = {}
for i, c in enumerate(s):
    if c not in cell_dict:
        cell_dict[c] = [i]
    else:
        cell_dict[c].append(i)

g_list = [1] * N

# print(cell_dict)
# print(g_list)

for td in td_list:
    if td[0] not in cell_dict:
        continue
    cell_list = cell_dict[td[0]]
    len_cell_list = len(cell_list)
    if td[1] == "L":
        for cid in cell_list:
            if cid != 0:
                g_list[cid - 1] = g_list[cid - 1] + g_list[cid]
            g_list[cid] = 0
    else:
        for cidx in range(len_cell_list - 1, -1, -1):
            cid = cell_list[cidx]
            if cid != N - 1:
                g_list[cid + 1] = g_list[cid + 1] + g_list[cid]
            g_list[cid] = 0
    # print(td)
    # print(cell_list)
    # print(g_list)

print(sum(g_list))
