# -*- coding: utf-8 -*-


def main():
    n, q = map(int, input().split())
    s = input()
    ls = list()
    rs = list()

    for i in range(q):
        ti, di = input().split()

        if di == 'L':
            ls.append(ti)
        else:
            rs.append(ti)

    count = 0
    i = 0

    for li in ls[::-1]:
        if li == s[i]:
            count += 1
            i += 1

    j = len(s) - 1

    for ri in rs[::-1]:
        if ri == s[j]:
            count += 1
            j -= 1

    print(n - count)


if __name__ == '__main__':
    main()
