n,q = map(int,input().split())
s = input()
position = [1 for i in range(n)]
keys = {}
keycheck = {}
for i in "qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM":
    keycheck[i] = True
for i in range(n):
    keys[s[i]] = []
    keycheck[s[i]] = False
for i in range(n):
    keys[s[i]].append(i)
for i in range(q):
    t,d = input().split()
    if keycheck[t]:continue
    check = 1 if d == 'R' else -1
    ls = keys[t]
    for j in range(len(ls)):
        num = position[ls[j]]
        position[ls[j]] = 0
        if ls[j]+check < 0 or ls[j]+check > n-1:continue
        position[ls[j]+check] += num

print(sum(position))