示例#1
0
        public static void Main()
        {
            string input = Console.ReadLine();

            HashTable <char, int> hashTable = new HashTable <char, int>();

            foreach (char c in input)
            {
                if (hashTable.ContainsKey(c))
                {
                    hashTable[c]++;
                }
                else
                {
                    hashTable[c] = 1;
                }
            }

            foreach (var keyValue in hashTable.OrderBy(kv => kv.Key))
            {
                Console.WriteLine($"{keyValue.Key}: {keyValue.Value} time/s");
            }
        }
示例#2
0
 public Dictionary()
 {
     this.table = new HashTable <TKey, TValue>();
 }