from sys import stdin

n, q = [int(x) for x in stdin.readline().rstrip().split()]
s = list(stdin.readline().rstrip())
spell = [stdin.readline().rstrip().split() for _ in range(q)]
golem = []

for i in range(len(s)):
    golem.append(1)

for i in range(q):
    t = spell[i][0]
    d = spell[i][1]

    if d == "L":
        for j in range(n):
            if s[j] == t:
                if j-1 >= 0:
                    golem[j-1] += golem[j]
                golem[j] = 0

    elif d == "R":
        for k in reversed(range(n)):
            if s[k] == t:
                if k+1 <= n-1:
                    golem[k+1] += golem[k]
                golem[k] = 0

print(sum(golem))