def move(before, after, golem):
    move_golems = golem[before]
    golem[before] = 0
    if 0 <= after < len(golem):
        golem[after] += move_golems
    return golem

n, q = map(int, input().split())
golem = [1 for i in range(n)]
board = input()
masu_chars = {}

for i, char in enumerate(board):
    if char in masu_chars:
        masu_chars[char].append(i)
    else:
        masu_chars[char] = [i]
        
for i in range(q):
    target, spell = input().split()
    if not target in masu_chars:
        continue
    effect = 1 if spell == 'R' else -1
    for target_masu in masu_chars[target][::-effect]:
        golem = move(target_masu, target_masu + effect, golem)

left_golem = sum(golem)
print(left_golem)