N, Q = map(int, input().split())
s_list = list(input())

s_dict = {}
for i, s in enumerate(s_list):
    if s not in s_dict.keys():
        s_dict[s] = [i]
    else:
        s_dict[s].append(i)

#print(s_dict)

        
count_list = [1] * N
for _ in range(Q):
#    print(count_list)
    t, d = input().split()
    
    if t not in s_dict.keys():
        continue
    indexes = s_dict[t]
    if d == "R":
        for i in reversed(indexes):
            if i == N-1:
                count_list[i] = 0
            else:
                count_list[i+1] += count_list[i]
                count_list[i] = 0
    else:
        for i in indexes:
            if i == 0:
                count_list[i] = 0
            else:
                count_list[i-1] += count_list[i]
                count_list[i] = 0

print(sum(count_list))
