using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int N = int.Parse(s[0]);
            int Q = int.Parse(s[1]);

            char[] c = Console.ReadLine().ToCharArray();

            int[] pos = new int[N+2];

            for (int i = 1; i <= N; i++)
                pos[i] = 1;

            System.Collections.ArrayList[] array = new System.Collections.ArrayList[26];

            for(int i=0;i<26;i++)
            {
                array[i] = new System.Collections.ArrayList();
            }

            for(int i=0;i<N;i++)
            {
                int p = (int)c[i] - 'A';
                array[p].Add(i+1);
            }

            for (int z = 0; z < Q; z++)
            {
                char[] qc = Console.ReadLine().ToCharArray();

                int p = qc[0] - 'A';

                for(int i=0;i<array[p].Count;i++)
                {
                    if (qc[2] == 'L')
                    {
                        pos[(int)array[p][i] -1] += pos[(int)array[p][i]];
                        pos[(int)array[p][i]] = 0;
                    }
                    else
                    {
                        pos[(int)array[p][i] + 1] += pos[(int)array[p][i]];
                        pos[(int)array[p][i]] = 0;
                    }

                }

            }

            int ans = 0;

            for(int i=1;i<=N;i++)
            {
                ans += pos[i];
            }


            Console.WriteLine(ans.ToString());
        }
    }
}
