using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace dictionaryTest
{
class Test
{
static void Main(string[] args)
{
Dictionary<int, int> dict = new Dictionary<int, int>();
string line;
while ((line = Console.ReadLine()) != string.Empty)
{
int temp = Int32.Parse(line);
//Convert.ToInt32(line);
if (dict.ContainsKey(temp))
{
dict[temp]++;
}
else
{
dict.Add(temp, 1);
}
}
int max = 0;
List<int> list = new List<int>();
if (dict.Count != 0)
{
foreach (KeyValuePair<int, int> item in dict)
{
if (item.Value > max)
{
max = item.Value;
}
}
foreach (KeyValuePair<int, int> item in dict)
{
if (item.Value == max)
{
list.Add(item.Key);
}
}
}
//print result
Console.WriteLine("max count: " + max);
Console.WriteLine();
Console.WriteLine("max number list:");
foreach (int item in list)
{
Console.WriteLine(item);
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace dictionaryTest
{
class Test
{
static void Main(string[] args)
{
Dictionary<int, int> dict = new Dictionary<int, int>();
string line;
while ((line = Console.ReadLine()) != string.Empty)
{
int temp = Int32.Parse(line);
//Convert.ToInt32(line);
if (dict.ContainsKey(temp))
{
dict[temp]++;
}
else
{
dict.Add(temp, 1);
}
}
int max = 0;
List<int> list = new List<int>();
if (dict.Count != 0)
{
foreach (KeyValuePair<int, int> item in dict)
{
if (item.Value > max)
{
max = item.Value;
}
}
foreach (KeyValuePair<int, int> item in dict)
{
if (item.Value == max)
{
list.Add(item.Key);
}
}
}
//print result
Console.WriteLine("max count: " + max);
Console.WriteLine();
Console.WriteLine("max number list:");
foreach (int item in list)
{
Console.WriteLine(item);
}
}
}
}