// 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 void count(string s) { int[] f = new int[256]; for(int i = 0; i < f.Length; i++) f[i] = 0; for(int j = 0; j < s.Length; j++) f[(int)s[j]]++; for(int i = 0; i < f.Length; i++) if(f[i] > 0) Console.WriteLine((char)i + " " + f[i]); } public static void Main(string[] args) { count("Dette er en test"); } }