ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1496. Spammer

C# Accepted
Posted by TARASHI {Kutaisi SU3} (Georgia) 7 Sep 2016 14:39
using System;
using System.Collections.Generic;

namespace CA_TimusRu
{
    class Program1496
    {
        static void Main(string[] args)
        {
            Dictionary<string, int> dict = new Dictionary<string, int>();
            int n = int.Parse(Console.ReadLine());
            for (int i = 0; i < n; i++)
            {
                string s = Console.ReadLine();
                if (dict.ContainsKey(s))
                    dict[s]++;
                else
                    dict.Add(s, 1);
            }

            foreach (var item in dict)
            {
                if (item.Value >= 2)
                    Console.WriteLine(item.Key);
            }
        }
    }
}