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

# WAなのは分かってるけど良いアイデアだと思ったのが空振って悔しいのでとりあえず投稿

from sys import stdin

def load():
    n = stdin.readline()
    return n

n,q = [ int(x) for x in load().strip().split(' ')]
n = int(n)

index = {}
for i,x in enumerate(load().strip()):
    if x not in index:
        index[x] = [i]
    else:
        index[x].append(i)

move = { x:0 for x in index.keys() }

for line in stdin.readlines():
    t,d = line.strip().split(' ')

    if t not in move:
        continue

    if d == 'L':
        move[t] -= 1
    else:
        move[t] += 1

living_golem = n
for x, hosu in move.items():
    for target in index[x]:
        if target + hosu >= n or target - hosu < 0:
            living_golem -= 1
print(living_golem)