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

golems = [1]*n

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