N, Q = map(int, input().split())
char_list = list(input())
golem_cnt = [1 for i in range(N)]

for i in range(Q):
    char_move, direction = input().split()
    target_idxs = [idx for idx, char in enumerate(char_list) if char == char_move]
    
    if (0 in target_idxs) & (direction == 'L'):
        golem_cnt[0] = 0
        target_idxs.remove(0)
    elif (N - 1 in target_idxs) & (direction == 'R'):
        golem_cnt[-1] = 0
        target_idxs.remove(N - 1)
    
    temp_golem_cnt = golem_cnt
    for target_idx in target_idxs:
        if direction == 'L':
            temp_golem_cnt[target_idx - 1] += golem_cnt[target_idx]
            temp_golem_cnt[target_idx] = 0
        else:
            temp_golem_cnt[target_idx + 1] += golem_cnt[target_idx]
            temp_golem_cnt[target_idx] = 0
            
    golem_cnt = temp_golem_cnt
    
print(sum(golem_cnt))