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

s = input()
gorem_dict = {s:i for i,s in enumerate(s)}
gorem_pos = [str(i) for i in range(N)]

for _ in range(Q):
    magic=input().split(" ")
    t = magic[0]
    d = magic[1]
    pos = gorem_dict[t]
    
    if d=="L":
        if pos==0:
            gorem_pos[pos]=""
        else:
            gorem_pos[pos-1]+=gorem_pos[pos]
            
    elif d=="R":
        if pos==N-1:
            gorem_pos[pos]=""
        else:
            gorem_pos[pos+-1]+=gorem_pos[pos]
    gorem_pos[pos]=""
print(len("".join(gorem_pos)))