using System;
using System.Collections.Generic;
using System.Linq;

namespace Exa2019C
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            long[] nq = Console.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
            string s = Console.ReadLine();
            char[][] qs = new char[nq[1]][];
            for (int i = 0; i < nq[1]; i++)
            {
                qs[i] = Console.ReadLine().Split(' ').Select(a => char.Parse(a)).ToArray();
            }

            Array.Reverse(qs);

            Dictionary<char, List<long>> dic = new Dictionary<char, List<long>>();

            for (int i = 0; i < nq[0]; i++)
            {
                if (!dic.ContainsKey(s[i]))
                {
                    dic.Add(s[i], new List<long>());
                }

                dic[s[i]].Add(i);
            }

            long[][] dp = new long[nq[1] + 1][];
            dp[0] = new[] {0, nq[0] - 1};

            for (int i = 1; i <= nq[1]; i++)
            {
                char[] query = qs[i - 1];
                dp[i] = new long[2];
                dp[i][0] = dp[i - 1][0];
                dp[i][1] = dp[i - 1][1];

                if (!dic.ContainsKey(query[0]))
                {
                    continue;
                }

                if (query[1] == 'R')
                {
                    if (dic[query[0]].Contains(dp[i][1]))
                    {
                        dp[i][1]--;
                    }
                }

                if (query[1] == 'L')
                {
                    if (dic[query[0]].Contains(dp[i][0]))
                    {
                        dp[i][0]++;
                    }
                }
            }

            long ans = nq[0];
            ans -= dp[nq[1]][0];
            ans -= nq[0] - dp[nq[1]][1] - 1;

            Console.WriteLine(ans);
        }
    }
}