DATA=list(map(int, input().split(" ")))
N = DATA[0]
Q = DATA[1]

s = input()


gorem_dict = {ss:[i for i, x in enumerate(s) if x == ss] for ss in s}
gorem_pos = [1 for i in range(N)]

for _ in range(Q):
    magic=input().split(" ")
    d = magic[1]
    poses = None
    if t in gorem_dict:
        poses=gorem_dict[magic[0]]
    else:
        continue
    
    dis = -1 if d=="L" else 1
        
    for pos in poses:
        if 0<=pos+dis<=N-1:
            gorem_pos[pos+dis]+=gorem_pos[pos]
        gorem_pos[pos]=0
            

print(len("".join(gorem_pos)))