# -*- coding: utf-8 -*-

nq = list(map(int,input().split()))
s = input()
td = []
for i in range(nq[1]):
    td.append(input().split())

s_index_dict = {}
for i,v in enumerate(s):
    s_index_dict.setdefault(v, [])
    s_index_dict[v].append(int(i))

g_list = [1] * nq[0]

for i in td:
    if i[0] not in s_index_dict:
        continue
    for j in s_index_dict[i[0]]:
        if i[1] == 'R' and j != nq[0] -1:
            g_list[j+1] += g_list[j]
        elif i[1] == 'L' and j != 0:
            g_list[j-1] += g_list[j]
        g_list[j] = 0

print(sum(g_list))