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

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split(' ').Select(ss => Int32.Parse(ss)).ToArray();
            var n = s[0];       //Room Size
            var q = s[1];       //Magic Number

            
            var line = Console.ReadLine().ToCharArray();    //Room Character
            Int32[] room = new Int32[n];


            //1  Calibration
            for (int h = 0; h < n; h++)
            {
                room[h] = 1;
            }

            // count
            for (int i = 0; i < q; i++)
            {
                var a = Console.ReadLine().Split(' ').Select(b => Char.Parse(b)).ToArray();

                for (int j = 0; j < n; j++)
                {
                    if (line[j] == a[0] && a[1] == 'L')
                    {
                        if (j != 0)
                        {
                            room[j - 1] += room[j];
                        }
                        room[j] = 0;
                    }
                    else if (line[n - 1 - j] == a[0] && a[1] == 'R')
                    {
                        if (j != 0)
                        {
                            room[n - j] += room[n - 1 - j];
                        }
                        room[n - 1 - j] = 0;
                    }

                }
                
            }

            int ans = room.Sum();
            Console.WriteLine(ans);
            
        }
    }
}
