N, Q = map(int, input().split())
s = input()
td = [input().split() for i in range(Q)]

t_set = set(list(zip(*td))[0])
t_dict = {}
for ti in t_set:
    tmp_list = []
    for i, si in enumerate(list(s)):
        if si == ti:
            tmp_list.append(i)
    t_dict[ti] = tmp_list

res = [1 for i in range(N)]
    
for t, d in td:
    if d == "R":
        for i in t_dict[t][::-1]:
            if i == N - 1:
                res[i] = 0
            else:
                res[i+1] += res[i]
                res[i] = 0
    else:
        for i in t_dict[t]:
            if i == 0:
                res[i] = 0
            else:
                res[i-1] += res[i]
                res[i] = 0
print(sum(res))