#!/bin/env python
# coding: utf-8

import sys
from collections import defaultdict

def main():
    N, Q = [int(x) for x in sys.stdin.readline().strip().split()]
    s = [(x, 1) for x in list(sys.stdin.readline().strip())]
    index_map = defaultdict(list)
    for i, d in enumerate(s):
        c, _ = d
        index_map[c].append(i)
    for _ in xrange(Q):
        c, direction = sys.stdin.readline().strip().split()
        # get index
        for index in index_map[c]:
            # get number on index
            _, num = s[index]
            if num == 0:
                # do nothing
                pass
            else:
                # update to 0
                s[index] = (c, 0)
                if direction == "R":
                    if index == len(s) - 1:
                        # do nothing
                        pass
                    else:
                        tmp = s[index + 1]
                        s[index + 1] = (tmp[0], tmp[1] + num)
                else:
                    if index == 0:
                        # do nothing
                        pass
                    else:
                        tmp = s[index - 1]
                        s[index - 1] = (tmp[0], tmp[1] + num)
    print(sum([x[1] for x in s]))

if __name__ == "__main__":
    main()
