using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    public static void Main()
    {
        int N = NextInt();
        int Q = NextInt();
        string s = NextString();
        char[] t = new char[Q];
        char[] d = new char[Q];
        int[] num = Enumerable.Repeat(1, N + 2).ToArray();
        Dictionary<char, HashSet<int>> dic = new Dictionary<char, HashSet<int>>();
        for (char a = 'A'; a <= 'Z'; a++) dic[a] = new HashSet<int>();
        for (int i = 0; i < N; i++)
        {
            dic[s[i]].Add(i + 1);
        }
        for (int i = 0; i < Q; i++)
        {
            t[i] = NextChar();
            d[i] = NextChar();
            if (d[i] == 'L')
            {
                foreach (var j in dic[t[i]])
                {
                    num[j - 1] += num[j];
                    num[j] = 0;
                }
            }
            else
            {
                foreach (var j in dic[t[i]])
                {
                    num[j + 1] += num[j];
                    num[j] = 0;
                }
            }
        }
        Console.WriteLine(num.Sum() - num[0] - num[N+1]);
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}
