def indexes(l,val):
    return [i for i,v in enumerate(l) if v == val]

#N体のゴーレムが存在
#Q回呪文を唱える
N,Q = map(int, input().split())
s = list(input())
golem_num = [1]*N

for i in range(Q):
    spell = list(input().split())
    move_golem_place = indexes(s,spell[0])
    
    for gp in move_golem_place:
        if spell[1] == 'R':
            if gp != N-1:
                golem_num[gp+1] += golem_num[gp]
            golem_num[gp] = 0
        else:
            if gp != 0:
                golem_num[gp-1] += golem_num[gp]
            golem_num[gp] = 0

print(sum(golem_num))