N, Q = map(int, input().split())
s = input()
spells = []
for i in range(Q):
    spells.append(list(input().split()))
T = 0
D = 1

s_idx = {}
for i in range(N):
    if(s[i] in s_idx):
        s_idx[s[i]] += [i]
    else:
        s_idx[s[i]] = [i]
#print("s_idx={}".format(s_idx))

golems = [1] * N
g_num = N
for spl in spells:
#    print("spl={}, {}".format(spl, spl[T] in s_idx))
    if(True != (spl[T] in s_idx)):
#        print("skip")
        continue
    if("L" == spl[D]):
        for i in sorted(s_idx[spl[T]]):
            if(0 == i):
                g_num -= golems[i]
            else:
                golems[i - 1] += golems[i]
            golems[i] = 0
    elif("R" == spl[D]):
        for i in sorted(s_idx[spl[T]], reverse=True):
            if(N - 1 == i):
                g_num -= golems[i]
            else:
                golems[i + 1] += golems[i]
            golems[i] = 0

print(str(g_num))
