'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7

def main():
    n,q = map(int,ipt().split())
    s = input()
    di = defaultdict(set)
    for i,si in enumerate(s):
        di[si].add(i)
    for dk,dv in di.items():
        di[dk] = sorted(dv)
#    print(d)
    glm = [1]*n
    for _ in range(q):
        t,d = map(str,input().split())
        if d == "L":
            for i in di[t]:
                if i == 0:
                    glm[0] = 0
                else:
                    glm[i-1] += glm[i]
                    glm[i] = 0
        else:
            for i in di[t][::-1]:
                if i == n-1:
                    glm[n-1] = 0
                else:
                    glm[i+1] += glm[i]
                    glm[i] = 0
    print(sum(glm))

    return None

if __name__ == '__main__':
    main()
