N, Q = map(int, input().split())
s = input()
queries = []
golems = [1 for _ in range(N)]
for _ in range(Q):
    t, d = input().split()
    flag = (d == 'L')
    if t not in s:
        continue
    queries.append((t, flag))
lens = len(s)
masume = {}
for i, char in enumerate(s):
    masume.setdefault(char, []).append(i)
r_masume = dict([(k, v[::-1]) for k, v in masume.items()])
# print(s)
# print(masume)
for query in queries:
    # print(golems)
    # print(query)
    if query[1]:
        for i in masume[query[0]]:
            moving = golems[i]
            golems[i] = 0
            if i > 0:
                golems[i-1] += moving
    else:
        for i in r_masume[query[0]]:
            moving = golems[i]
            golems[i] = 0
            if i < lens - 1:
                golems[i+1] += moving
num = sum(golems)
# print(golems)
print(num)
