l = input().split(" ")
n = int(l[0])
q = int(l[1])
s = "*"+input()+"*"
gorems = [1 for i in range(n + 2)]
gorems[0] = 0
gorems[-1] = 0

l = []
for i in range(q):
    spell = input().split(" ")
    l.append(spell)
for j in range(q):
    #to right
    if (l[j][1] == "R"):
        for i in range(1, n+1):
            if l[j][0]==s[i]:
                gorems[i + 1] = gorems[i + 1] + gorems[i]
                gorems[i] = 0
    #to left
    if(l[j][1]=="L"):
        for i in range(1,n+1):
            if l[j][0] == s[-i-1]:
                gorems[-i - 2] = gorems[-i - 2] + gorems[-i-1]
                gorems[-i-1] = 0


print(n-gorems[0]-gorems[-1])