using System;
using System.Linq;
public class Program
{
public static void Main()
var s = "S3;S4;S3;S4;S5;S5;S4;S4;S4";
string[] words = s.Split(';');
int x=0;
foreach (string word in words)
x= s.Count(x => x == '&');
Console.WriteLine(x);
}