// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Linq; namespace E { public class Program { public static double WeirdFind(string vals, string targets) { int[] vals2 = vals.Split(',').Select(s => int.Parse(s)).ToArray(); int[] targets2 = targets.Split(',').Select(s => int.Parse(s)).ToArray(); double res = vals2.Count(v => targets2.Contains(v)); return res/vals2.Length; } public static void Main(string[] args) { string combination = "20,56,27,28,28"; string findthis = "20,27,28,20,00,11,23"; Console.WriteLine(WeirdFind(combination, findthis)); } } }