nums = [int(x) for x in input().split()]
squares = input()
count = [1] * nums[0]

def shift(letter, offset):
    for i,c in enumerate(squares):
        if not c == letter:
            continue
        if i + offset >=0 and i + offset < nums[0]:
            count[i + offset] += count[i]
        count[i] = 0


for i in range (nums[1]):
    items = input().split()
    offset = -1 if items[1] == 'L' else 1
    shift(items[0],offset)

print(sum(count))