N, Q = map(int, input().split(" "))
s = input()
goremIndex = {}
charIndex = {}


for i in range(len(s)) :
    if s[i] not in goremIndex :
        goremIndex[s[i]] = []
    goremIndex[s[i]].append(i)
    charIndex[i] = s[i]
    
    
for i in range(Q) :
    t, d = input().split(" ")
    if t not in goremIndex :
        continue
    d = (-1 if d == "L" else 1)
    temp = 0
    for j in range(len(goremIndex[t])) :
        goremIndexValue = goremIndex[t][j-temp]
        newGoremIndexValue = goremIndexValue + d
        if newGoremIndexValue < 0 or newGoremIndexValue > N-1 :
            goremIndex[t].pop(j-temp)
            temp += 1
        elif t != charIndex[newGoremIndexValue] :
            goremIndex[t].pop(j-temp)
            goremIndex[charIndex[newGoremIndexValue]].append(newGoremIndexValue)
            temp+=1
        
count = 0
for i in goremIndex :
    count += len(goremIndex[i])
print(count)
