from collections import defaultdict
N, Q = map(int,input().strip().split())
ss = list(input())
dic = defaultdict(list)
gg = [1] * N
for i, s in enumerate(ss):
    dic[s].append(i)

for i in range(Q):
    t, d = input().strip().split()
    if d == 'L':
        for k in dic[t]:
            if k == 0:
                gg[k] = 0
            else:
                gg[k-1] += gg[k]
                gg[k] = 0
    else:
        for k in dic[t][::-1]:
            if k == N-1:
                gg[k] = 0
            else:
                gg[k+1] += gg[k]
                gg[k] = 0
print(sum(gg))