using System;
using System.Collections.Generic;


public class C
{
	public static void Main()
	{
		string[] args;
		args = Console.ReadLine().Split(' ');
		int N = Int32.Parse(args[0]);
		int Q = Int32.Parse(args[1]);
		
		string s = '\0' + Console.ReadLine();
		
		Dictionary<char, List<int>> dict = 
			new Dictionary<char, List<int>>(26);
		for(int i = 0; i < 26; i++)
			dict.Add((char)((int)'A' + i), new List<int>());
		
		for(int i = 1; i <= N; i++)
			dict[s[i]].Add(i);
		
		for(int i = 0; i < Q; i++)
		{
			args = Console.ReadLine().Split(' ');
			char t = (args[0])[0];
			char d = (args[1])[0];

			if(d == 'L')
			{
				int current = dict[t].Count;
				for(int j = current - 1; j >= 0; j--)
				{
					int x = (dict[t])[j];
					dict[t].RemoveAt(j);
					if(x != 1)
						dict[s[x - 1]].Add(x - 1);			
				}		
			}
			else
			{
				int current = dict[t].Count;
				for(int j = current - 1; j >= 0; j--)
				{
					int x = (dict[t])[j];
					dict[t].Remove(x);
					if(x != N)
						dict[s[x + 1]].Add(x + 1);			
				}				
			}
		}
		
		int result = 0;
		foreach(char c in dict.Keys)
			result += dict[c].Count;
			
		Console.WriteLine(result);
	}
}