def convertDirectionToNumber(direction) :
    if direction == "L" :
        return -1
    else :
        return 1

def moveGorem(g_num , position , direction_num) :
    if position + direction_num < 0 :
        g_num[position] = 0
    elif position + direction_num >= N :
        g_num[position] = 0
    else :
        g_num[position + direction_num] += g_num[position]
        g_num[position] = 0

s = input().split(" ")
N = int(s[0]) #マスの数
Q = int(s[1]) #呪文の数

s = input() #マスの並び順
dic = {}
for (index , c) in enumerate(s) :
    if not c in dic : dic[c] = [index]
    else : dic[c].append(index)


g_num = [1 for i in range(N)]
for _ in range(Q) :
    move = input().split()
    position = move[0]
    direction = move[1]
    direction_num = convertDirectionToNumber(direction)
    position_list = dic.get(position)
    if position_list is None : continue
    for position in position_list:
        moveGorem(g_num , position , direction_num)
print(sum(g_num))