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

from sys import stdin

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

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

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

golem = [1 for n in range(n)]

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

    if t not in index:
        continue

    for target in index[t]:
        if isLeft:
            if target > 0:
                golem[target-1] += golem[target]
            golem[target] = 0
        else:
            if target < n - 1:
                golem[target+1] += golem[target]
        golem[target] = 0

print(sum(golem))