def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]

def zeros(n): return [0]*n
def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替

INF = 10**18

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                x = cmt + ': ' + str(x)
            else:
                x = str(x)
            print(x)
        return x
    
def prob():
    d = Debug()
    d.off()
    N, Q = getIntList()
    S = input()
    d.dmp((N,Q), 'N,Q')
    d.dmp((S), 'S')
    pos = [[] for i in range(26)]  # 英字別の位置
    cell = [1 for i in range(N)]
    for i in range(N):
        pos[ord(S[i])-ord('A')].append(i)
    d.dmp((pos), 'pos')
    count = 0
    #d.dmp((cell), 'cell')
    for i in range(Q):
        frame, direction = [x for x in input().split()]
        d.dmp((frame, direction), 'frame, direction')
        idx = ord(frame) - ord('A')
        posList = pos[idx]
        if direction == 'R':
            for k in range(len(posList)-1, -1, -1):
                p = posList[k]
                if p == N-1:
                    count += cell[N-1]
                else:
                    cell[p+1] += cell[p]
                cell[p] = 0
        else:  # 'L'
            for k in range(len(posList)):
                p = posList[k]
                if p == 0:
                    count += cell[0]
                else:
                    cell[p-1] += cell[p]
                cell[p] = 0
        #d.dmp((cell), 'cell')
    d.dmp((cell), 'cell')
    return N - count

ans = prob()
print(ans)
