n, q = map(int, input().split())
s = list(input())
s_list = [[i, s_, 1] for i, s_ in enumerate(s)]
for j in range(q):
    t, d = input().split()
    if d == "R":
        for s in reversed(s_list):
            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 in s_list:
            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))