n, q = [int(_) for _ in input().split()]
s = input()
s_dict = {'A':[], 'B':[], 'C':[], 'D':[],'E':[],'F':[],'G':[],'H':[],'I':[],'J':[],'K':[],'L':[],
          'M':[], 'N':[] ,'O':[], 'P':[],'Q':[],'R':[],'S':[],'T':[],'U':[],'V':[],'W':[],'X':[],'Y':[],'Z':[]}
for i in range(n):
    s_dict[s[i]].append(i)

t = []
d = []
for i in range(q):
    ti, di = input().split()
    t.append(ti)
    d.append(di)

gs = [1] * n
for i in range(len(t)):
    if d[i] == 'L':
        for j in s_dict[t[i]]:
            if gs[j] == 0:
                continue
            if j != 0:
                gs[j-1] += gs[j]
            gs[j] = 0

    else:
        for j in s_dict[t[i]][::-1]:
            if gs[j] == 0:
                continue
            if j != n-1:
                gs[j+1] += gs[j]
            gs[j] = 0

print(sum(gs))


