import sys
input = sys.stdin.readline

def function():
    N , Q = map(int , input().split())
    s = input()
    tdlist = [list(input().split()) for _ in range(Q)]
    #print(tdlist)
    slist = [[s[j] ,1] for j in range(N)]
    #print(slist)
    ans = N
    for td in tdlist:
        if td[1] == 'L':
            if td[0] == slist[0][0]:
                ans -= slist[0][1]
                slist[0][1] = 0
            for i in range(N-1):
                if slist[i+1][0] == td[0]:
                    slist[i][1] += slist[i+1][1]
                    slist[i+1][1] = 0
        else:
            if td[0] == slist[-1][0]:
                ans -= slist[-1][1]
                slist[-1][1] = 0
            for i in reversed(range(N-1)):
                if slist[i][0] == td[0]:
                    slist[i+1][1] += slist[i][1]
                    slist[i][1] = 0
    #print(slist)
    print(ans)
    
function()