# -*- coding: utf-8 -*-

N, Q = map(int, input().split())
s = input()

chr_Dict = {}
for i in range(65, 65+26):
    chr_Dict[chr(i)] = []

for i in range(N):
    chr_Dict[s[i]].append(i)

Q_list = []
for i in range(Q):
    Q_list.append(list(input().split()))

base = [1] * N

for query in Q_list:
    if query[1] == 'L':
        for i in chr_Dict[query[0]]:
            if not i == 0:
                base[i-1] += base[i]
            base[i] = 0
    else:
        rev = chr_Dict[query[0]]
        for i in reversed(chr_Dict[query[0]]):
            if not i == N - 1:
                base[i+1] += base[i]
            base[i] = 0

total = 0
for i in base:
    total += i

print(total)