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 = [str(i) for i in range(N)]

for _ in range(Q):
    magic=input()#.split(" ")
    t = magic[0]
    d = magic[-1]
    poses = []
    if t in gorem_dict:
        poses=gorem_dict[t]
    else:
        continue
        
    if d=="L":
        for pos in poses:
            if pos!=0:
                gorem_pos[pos-1]+=gorem_pos[pos]
            gorem_pos[pos]=""
            
    elif d=="R":
        for pos in poses:

            if pos!=N-1:
                gorem_pos[pos+1]+=gorem_pos[pos]
            gorem_pos[pos]=""
print(len("".join(gorem_pos)))