N, Q = map(int, input().split())
s = input()
golems = list()
for _ in range(len(s)):
    golems.append(1)

for _ in range(Q):
    t, d = input().split()
    for i in range(len(s)):
        if s[i] != t:
            continue

        if d == 'L' and i != 0:
            golems[i - 1] += golems[i]
        elif d == 'R' and i != len(s) - 1:
            golems[i + 1] += golems[i]

        golems[i] = 0

print(sum(golems))