def main():
    N, Q = map(int, input().split())
    # tと対応する
    s = input()
    le = len(s)
    a = [1] * len(s)

    # ti=識別子, di=L,R
    for q in range(Q):
        t, d = input().split()
        m = -1 if d == 'L' else 1

        for i in range(le):
            if s[i] == t:
                n = a[i]
                a[i] = 0

                to = i+m
                if 0 <= to < le:
                    a[to] += n
    print(sum(a))


if __name__ == '__main__':
    main()