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

s = list(input())

'''
l = [list(input().split()) for i in range(4)]
'''

ooo = [[] for i in range(26)]

for i in range(n):
    k = ord(s[i]) - 65
    ooo[k].append(i)

o = [1 for i in range(n)]
for i in range(q):
    r,t = input().split()
    if t == "R":
        for j in ooo[ord(r) - 65]:
            if j == n-1:
                o[n-1] = 0
            else:
                o[j+1] += o[j]
                o[j] = 0
    else:
        for j in ooo[ord(r) - 65]:
            if j == 0:
                o[0] = 0
            else:
                o[j-1] += o[j]
                o[j] = 0

print(sum(o))
