// 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; class MainClass { public static int DiffChar(string s1,string s2) { string tmp1 = s1.ToUpper(); string tmp2 = s2.ToUpper(); int res = 0; for(int i = 0; i < Math.Min(tmp1.Length,tmp2.Length); i++) { if(tmp1[i] != tmp2[i]) { res++; } } res = res + Math.Max(tmp1.Length,tmp2.Length) - Math.Min(tmp1.Length,tmp2.Length); return res; } public static void Main(string[] args) { Console.WriteLine(DiffChar("abcde","axcye")); Console.WriteLine(DiffChar("abcde","axcy")); Console.WriteLine(DiffChar("abcd","axcye")); } }