n, q = map(int, input().split())
golem = [1 for i in range(n)]
golem.append(0)
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):
    if sum(golem[0:n]) == 0:
        print(0)
        break
    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]:
        if golem[target_masu] != 0:
            golem[target_masu + effect] += golem[target_masu]
            golem[target_masu] = 0
else:
    left_golem = sum(golem[0:n])
    print(left_golem)