N, Q = map(int, input().split())
S = input()
magic = [None] * 26
for i in range(len(S)):
    if magic[ord(S[i]) - ord("A")] is None:
        magic[ord(S[i]) - ord("A")] = [i]
    else:
        magic[ord(S[i]) - ord("A")].append(i)

num_in_the_location = [1]*N
for i in range(Q):
    t, d = input().split()
    #print("\n", t)
    t = ord(t) - ord("A")
    if magic[t] is None:
        continue
    if d == "L":
        # left = True
        for j in range(len(magic[t])):
            if magic[t][j] > 0:
                num_in_the_location[magic[t][j]
                                    ], num_in_the_location[magic[t][j] - 1] = 0, num_in_the_location[magic[t][j] - 1] + num_in_the_location[magic[t][j]
                                                                                                                                            ]
            else:
                num_in_the_location[magic[t][j]] = 0

    else:
        for j in range(len(magic[t])):
            #print(t, magic[t][j], magic[t][j]+1, magic[t])
            if magic[t][j] < N-1:
                num_in_the_location[magic[t][j]
                                    ], num_in_the_location[magic[t][j]+1] = 0, num_in_the_location[magic[t][j]+1]+num_in_the_location[magic[t][j]
                                                                                                                                      ]
            else:
                num_in_the_location[magic[t][j]] = 0
# print(num_in_the_location)
print(sum(num_in_the_location))
