# -*- coding: utf-8 -*-
n, q = map(int, input().split())
s = input()

golems = [1]*n

for _ in range(q):
    target, direction = input().split()
    if direction == 'L':
        for i, c in enumerate(s):
            if c == target:
                if i == 0:
                    golems[0] = 0
                elif golems[i] > 0:
                    golems[i-1] = golems[i-1]+golems[i]
                    golems[i] = 0
    else:
        golems = golems[::-1]
        for i, c in enumerate(s[::-1]):
            if c == target:
                if i == 0:
                    golems[0] = 0
                elif golems[i] > 0:
                    golems[i-1] = golems[i-1]+golems[i]
                    golems[i] = 0
        golems = golems[::-1]
print(sum(golems))