def main():
    line_split = input().split()
    N = int(line_split[0])
    Q = int(line_split[1])

    s = input()
    alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    group_index = {}
    for char in alphabet:
        group_index[char] = []
    for i in range(N):
        char = s[i]
        group_index[char].append(i)
    golems = [1 for i in range(N)]

    for i in range(Q):
        line_split = input().split()
        t = line_split[0]
        d = line_split[1]
        if d == "R":
           golems = move_golems_right(golems, group_index[t], N)
        else:
            golems = move_golems_left(golems, group_index[t], N)

    print(sum(golems))

def move_golems_right(golems, group_index, N):
    increase_cells = [0 for i in range(N)]
    for i in group_index:
        if i != N-1:
            increase_cells[i+1] = golems[i]
        golems[i] = 0
    for i in group_index:
        if i != N-1:
            golems[i+1] += increase_cells[i+1]
    return golems

def move_golems_left(golems, group_index, N):
    increase_cells = [0 for i in range(N)]
    for i in group_index:
        if i != 0:
            increase_cells[i-1] = golems[i]
        golems[i] = 0
    for i in group_index:
        if i != 0:
            golems[i-1] += increase_cells[i-1]
    return golems

if __name__ == "__main__":
    main()