n,q = map(int,input().split())
s = input()


lis = [1 for i in range(n)]

dic = {}
for i in range(n):
    if not s[i] in dic:
        dic[s[i]] = [i]
    else:
        dic[s[i]].append(i)

for i in range(q):
    t,d = input().split()
    if t in dic:
        for num in dic[t]:
            if d == "L":
                if num != 0:
                    lis[num-1] += lis[num]
                    lis[num] = 0
                else:
                    lis[num] = 0
            if d == "R":
                if num != n-1:
                    lis[num+1] += lis[num]
                    lis[num] = 0
                else:
                    lis[num] = 0

print(sum(lis))
