from collections import defaultdict

N, Q = map(int, input().split())
s = input()
TD = [list(input().split()) for _ in range(Q)]
golem = [1 for _ in range(N)]

# sの文字列から、英文字->対応するマスの要素を抜き取る
pointer = defaultdict(list)
for i in range(len(s)):
    pointer[s[i]].append(i)

for td in TD:
    t, d = td[0], td[1]
    # 移動させる
    for p in pointer[t]:
        #print("move", p, d)
        if d == 'L':
            if p > 0:
                golem[p-1] += golem[p]
            golem[p] = 0
        else:
            if p < N - 1:
                golem[p+1] += golem[p]
            golem[p] = 0
        #print("g", golem)

#print(N, Q)
#print(s)
#print(TD)
#print(pointer)
#print(golem)
print(sum(golem))