from collections import defaultdict
n,q = map(int,input().split())
s = input()
ans_l = [1]*n
memo = defaultdict(list)

for i,c in enumerate(s):
    memo[c] .append(i)

for _ in range(q):
    td= input().split()
    t,d = td[0],td[1]
    for i in memo[t]:
        if i > 0 and d == "L":
            ans_l[i-1] += ans_l[i]
        elif i < n-1 and d == "R":
            ans_l[i+1] += ans_l[i]
        ans_l[i] = 0
        
print(sum(ans_l))