def func(t,d,math,golem):
    for i in range(len(math)):
        if d == "R":
            index = len(math) - (i+1)
            #print(d,index)
            if math[index] == t:
                #print("I found " + t + " at " + str(index))
                golem[index+1] += golem[index]
                golem[index] = 0
        else:
            index = i
            #print(d,index)
            if math[index] == t:
                #print("I found "+ t + " at " + str(index))
                golem[index-1] += golem[index]
                golem[index] = 0
    return golem
N,Q = map(int,input().split())
math= list(" " + input() + " ")
golem = [1 for i in range(N+2)]
for i in range(Q):
    golem[0] = 0
    golem[N+1] = 0
    t,d = input().split()
    golem = func(t,d,math,golem)
golem[0] = 0
golem[N+1] = 0
#print(golem)
print(sum(golem))
