N, Q = map(int, input().split())
s_lst = [(pos, s) for pos, s in enumerate(input())]
for q in range(Q):
    t, d = input().split()
    mov = -1 if d == "L" else 1
    s_lst = [(s[0] + mov, s[1]) if s[1] == t else s for s in s_lst]
    s_lst = [s for s in s_lst if s[0] >= 0 and s[0] < N]
print(len(s_lst))