N, Q = map(int, input().split())
S = input()
go_list = [0] +  [1]*N + [0]

s_index = {}
for n in range(N):
    if S[n] in s_index.keys():
        s_index[S[n]].append(n)
    else:
        s_index[S[n]] = [n]

for q in range(Q):
    t, d = map(str, input().split())
    if t in S:
        indexes = s_index[t]
        if d == 'R':
            for index in reversed(list(indexes)):
                go_list[index+2] += go_list[index+1] 
                go_list[index+1] = 0
        else:
            for index in indexes:
                go_list[index] += go_list[index+1] 
                go_list[index+1] = 0    

print(N-go_list[0] - go_list[-1])
    
