using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{

    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string[] line = S.Split(' ');
            int N = int.Parse(line[0]);
            int Q = int.Parse(line[1]);
            string s = Console.ReadLine();
            List<int>[] alp = new List<int>[26];
            for (int i = 0; i < 26; i++)
            {
                alp[i] = new List<int>();
            }
            int[] golem = new int[N];

            for (int i = 0; i < N; i++)
            {
                alp[s[i] - 'A'].Add(i);
                golem[i] = 1;
            }

            int del = 0;

            for (int i = 0; i < Q; i++)
            {
                S = Console.ReadLine();
                line = S.Split(' ');
                string t = line[0];
                string d = line[1];
                int ti = t[0] - 'A';
                for (int j = 0; j < alp[ti].Count; j++)
                {
                    if (golem[alp[ti][j]] != 0) { 
                        if (d[0] == 'L')
                        {
                            if (alp[ti][j] == 0)
                            {
                                del = del + golem[0];
                                golem[0] = 0;
                            }
                            else
                            {
                                golem[alp[ti][j] - 1] = golem[alp[ti][j] - 1] + golem[alp[ti][j]];
                                golem[alp[ti][j]] = 0;
                            }
                        }
                        else
                        {
                            if (alp[ti][j] == N - 1)
                            {
                                del = del + golem[N - 1];
                                golem[N - 1] = 0;
                            }
                            else
                            {
                                golem[alp[ti][j] + 1] = golem[alp[ti][j] + 1] + golem[alp[ti][j]];
                                golem[alp[ti][j]] = 0;
                            }
                        }
                    }
                }

            }
            Console.WriteLine(N - del);

        }
    }
}