import sys

N, Q = map(int, sys.stdin.readline().split())
s = sys.stdin.readline().strip()
ops = [l.split() for l in sys.stdin.readlines()]

class Item:
    def __init__(self, i, c, cnt=1):
        self.i = i
        self.c = c
        self.count = cnt

S = [Item(i, x) for i, x in enumerate(s)]
M = {}
for s in S:
    if s.c not in M:
        M[s.c] = []
    M[s.c].append(s)

for t, d in ops:
    shift = 1 if d == 'R' else -1
    tmp = M.get(t)
    if tmp is None:
        continue
    for s in tmp:
        new_i = s.i + shift
        if new_i >= 0 and new_i < len(S):
            S[new_i].count += s.count
        s.count = 0

ret = 0
for s in S:
    ret += s.count
print(ret)