using System;
using System.Collections.Generic;

namespace CSsample
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string s = Console.ReadLine();
            var x = input.Split(' ');
            int N = int.Parse(x[0]);
            int Q = int.Parse(x[1]);
            int[] nums = new int[N];
            List<string> inp = new List<string> { };
            for(int i = 0; i < Q; i++)
            {
                inp.Add(Console.ReadLine());
            }
            for(int i = 0; i < N; i++)
            {
                nums[i] = 1;
            }
            for (int i = 0; i < Q; i++)
            {
                string ip = inp[i];
                var y = ip.Split(' ');
                int pos = 0;
                if (y[1] == "L")
                {
                    pos = s.IndexOf(y[0][0]);
                    while(pos != -1)
                    {
                        if(pos != 0)
                        {
                            nums[pos - 1] += nums[pos];
                        }
                        nums[pos] = 0;
                        pos = s.IndexOf(y[0][0], pos + 1);
                    }
                }
                if (y[1] == "R")
                {
                    pos = s.LastIndexOf(y[0][0]);
                    while(pos != -1)
                    {
                        if(pos != (N-1))
                        {
                            nums[pos + 1] += nums[pos];
                        }
                        nums[pos] = 0;
                        if (pos == 0)
                        {
                            break;
                        }
                        else
                        {
                            pos = s.LastIndexOf(y[0][0], pos - 1);
                        }
                    }
                }
            }
            int sum = 0;
            for(int i = 0; i < N; i++)
            {
                sum += nums[i];
            }
            Console.WriteLine(sum);

        }
    }
}

