n,q = (int(i) for i in input().split())
s = input()
td = [[i for i in input().split()] for i in range(q)]

dic = {"A":[],"B":[],"C":[],"D":[],"E":[],"F":[],"G":[],"H":[],"I":[],"J":[],"K":[],"L":[],"M":[],"N":[],"O":[],"P":[],"Q":[],"R":[],"S":[],"T":[],"U":[],"V":[],"W":[],"X":[],"Y":[],"Z":[]}

for i,x in enumerate(s):
    dic[x].append(i)

glm = [1]*n

for t,d in td:
    if d =="L":
        for i in sorted(dic[t]):
            if i != 0:
                glm[i-1] += glm[i]
            glm[i] = 0
    else:
        for i in sorted(dic[t],reverse=True):
            if i != n-1:
                glm[i+1] += glm[i]
            glm[i] = 0

print(sum(glm))