import copy
N, Q = map(int, input().split())
s = str(input())
TD = [list(map(str, input().split())) for i in range(Q)]

# どんどん合体していくことだけはわかった
hash = {}
for i in range(N):
    if s[i] in hash.keys():
        hash[s[i]].append(i)
    else:
        hash[s[i]] = [i]

for t, d in TD:
    if t not in hash.keys():
        continue
    if d == 'R':
        r_list = map(lambda x: x+1, hash[t])
        hash[t] = []
        for r in r_list:
            if 0 <= r <= N-1:
                hash[s[r]].append(r)
    else:
        l_list = map(lambda x: x-1, hash[t])
        hash[t] = []
        for l in l_list:
            if 0 <= l <= N - 1:
                hash[s[l]].append(l)

ans = 0
for d in hash.values():
    ans += len(d)
print(ans)