from collections import defaultdict

dic = defaultdict(list)

tmp = list(map(int,input().split()))
n=tmp[0]
q=tmp[1]

mas = [1] * n
# print(mas)

for i,c in enumerate(list(input())):
    dic[c].append(i)

# print(n,q,str)
# print(dic)

for i in range(q):
    charm=input().split()
    if charm[1]=="L":
        for hit in dic[charm[0]]:
            if 0 <= (hit-1):
                mas[hit-1] += mas[hit]
            mas[hit] = 0
    else:
        for hit in dic[charm[0]]:
            if n > (hit+1):
                mas[hit+1] += mas[hit]
            mas[hit] = 0

# print(mas)
print(sum(mas))
