from collections import defaultdict

N, Q = list(map(int, input().split()))
s = input()
dic = defaultdict(list)
for i, c in enumerate(s):
    dic[c].append(i)
golem = [1] * N
for _ in range(Q):
    t, d = input().split()
    if d == 'L':
        for i in dic[t]:
            if i > 0:
                golem[i-1] += golem[i]
                golem[i] = 0
            else:
                golem[i] = 0
    else:
        for i in dic[t]:
            if i < N-1:
                golem[i+1] += golem[i]
                golem[i] = 0
            else:
                golem[i] = 0
print(sum(golem))
