N, Q = map(int, input().split())
s = input()
ans = 0
if 2*Q <= N:
    a = s[:Q]+s[N-Q:]
    b = set(a)
    ls = [1]*len(a)
    for _ in range(Q):
        t, d = map(str, input().split())
        if t in b:
            if d == 'L':
                for i, x in enumerate(a):
                    if x == t:
                        if i == 0:
                            ans += ls[0]
                            ls[0] = 0
                            continue
                        else:
                            ls[i-1] += ls[i]
                            ls[i] = 0
            if d == 'R':
                for i, x in enumerate(a[::-1]):
                    if x == t:
                        if i == 0:
                            ans += ls[-1]
                            ls[-1] = 0
                            continue
                        else:
                            ls[len(a)-i] += ls[len(a)-1-i]
                            ls[len(a)-1-i] = 0
    print(N-ans)
else:
    b = set(s)
    ls = [1]*N
    for _ in range(Q):
        t, d = map(str, input().split())
        if t in b:
            if d == 'L':
                for i, x in enumerate(s):
                    if x == t:
                        if i == 0:
                            ans += ls[0]
                            ls[0] = 0
                            continue
                        else:
                            ls[i-1] += ls[i]
                            ls[i] = 0
            if d == 'R':
                for i, x in enumerate(s[::-1]):
                    if x == t:
                        if i == 0:
                            ans += ls[-1]
                            ls[-1] = 0
                            continue
                        else:
                            ls[len(s)-i] += ls[len(s)-1-i]
                            ls[len(s)-1-i] = 0
    print(N-ans)
