from sys import stdin


rr = lambda: stdin.readline().strip()
rri = lambda: int(rr())
rrm = lambda: list(map(int, rr().split()))

n, q = rrm()
total = n
s = list(rr())
index = {}
for i, char in enumerate(s):
    if char not in index:
        index[char] = [i]
    else:
        index[char].append(i)
spells = []
golems = [1]*n
for i in range(q):
    chr, move = rr().split()
    if chr not in index:
        continue

    for pos in index[chr]:
        if golems[pos] == 0:
            continue

        if pos == 0 and move == 'L':
            total -= golems[0]
            golems[0] = 0
        elif pos == n-1 and move == 'R':
            total -= golems[n-1]
            golems[n-1] = 0

        else:
            here = golems[pos]
            if move == 'L':
                golems[pos-1] += here
            else:
                golems[pos+1] += here

            golems[pos] = 0

print(total)
