N,Q = map(int, input().split())
s = list(input())
golem_num = [1]*N
disappear_num = 0

for i in range(Q):
    spell = list(input().split())
    
    for j,v in enumerate(s):
        if v != spell[0]:
            continue
        
        if spell[1] == 'R':
            if j == N-1:
                disappear_num += golem_num[j]
            else:
                golem_num[j+1] += golem_num[j]
                
            golem_num[j] = 0
        else:
            if j == 0:
                disappear_num += golem_num[j]
            else:
                golem_num[j-1] += golem_num[j]
            golem_num[j] = 0

print(N-disappear_num)