from collections import defaultdict
n,q = map(int,input().split())
s = input()
TD = [tuple(input().split()) for i in range(q)]
# print(TD)

dic = defaultdict(list)
for i in range(n): dic[s[i]].append(i+1)

golem = [1] * (n+2)

for td in TD:
    tmp = golem[:]
    for i in dic[td[0]]:
        if tmp[i] > 0: golem[i] = 0
        if td[1] == 'R':
            if tmp[i+1] < n and tmp[i] > 0: golem[i+1] += tmp[i]
        if td[1] == 'L':
            if tmp[i-1] < n and tmp[i] > 0: golem[i-1] += tmp[i]

print(sum(golem[1:-1]))