n, q = list(map(int, input().split()))
s = input()
place_dict = dict()

for i, v in enumerate(s):
    if v in place_dict.keys():
        place_dict[v].append(i)
    else:
        place_dict[v] = [i]
place_keys = place_dict.keys()

golems = [1 for _ in range(n)]

for _ in range(q):
    t, d = input().split()
    if t in place_keys:
        for v in place_dict[t]:
            golem = golems[v]
            if golem > 0:
                golems[v] = 0
                if d == "L" and v - 1 >= 0:
                    golems[v - 1] += golem
                elif d == "R" and v + 1 < n:
                    golems[v + 1] += golem
print(sum(golems))