import numpy as np

n, q= map(int, input().split())
s = input()

masu = np.ones(n+2)

def my_index_multi(l, x):
    return [i+1 for i, _x in enumerate(l) if _x == x]

for i in range(q):
    t, d = map(str, input().split())
    
    index = my_index_multi(s, t)

    if d == "R":
        tmp = masu[index]
        masu[index] = 0
        t_index = list(map(lambda x: x + 1, index))
        masu[t_index] += tmp
    else:
        tmp = masu[index]
        masu[index] = 0
        t_index = list(map(lambda x: x - 1, index))
        masu[t_index] += tmp       

print(int(np.sum(masu[1:n+1])))