n, q = map(int, input().split())
s = list(input())
s_list = [[i, s_, 1] for i, s_ in enumerate(s)]
s_dict = {s_:[i for i, x in enumerate(s) if x == s_] for s_ in list(set(s))}
for j in range(q):
    t, d = input().split()
    if t in s_dict.keys():
        if d == "R":
            for s_index in reversed(s_dict[t]):
                s = s_list[s_index]
                if s[1] == t:
                    if (s[0]+1) < n:
                        s_list[s[0]+1][2] += s[2]
                    s_list[s[0]][2] = 0
        else:
            for s_index in s_dict[t]:
                s = s_list[s_index]
                if s[1] == t:
                    if (s[0]-1) >= 0:
                        s_list[s[0]-1][2] += s[2]
                    s_list[s[0]][2] = 0
aaa = list(map(lambda x: x[2], s_list))
print(sum(aaa))