from collections import*
from copy import deepcopy
n,q=map(int,input().split())
ans=deepcopy(n)

d=defaultdict(list)
d2=defaultdict(int)
mad=defaultdict(int)
mid=defaultdict(int)
for k,v in enumerate(input()):
    d[v].append(k)
for i in range(q):
    s,t=input().split()
    if t=="L":
        d2[s]-=1
    else:
        d2[s]+=1
    if d2[s]<mid[s]:
        mid[s]=d2[s]
    elif d2[s]>mad[s]:
        mad[s]=d2[s]

for k,v in d.items():
    x=mid[k]
    y=mad[k]
    for i in v:
        if i+x<0 or i+y>n-1:
            ans-=1
print(ans)
