Advertisement
MyOnAsSalat

Untitled

Nov 30th, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace Задачи_CodeForces
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Dictionary<string, int> archive = new Dictionary<string, int>();
  11.             int linesCount = int.Parse(Console.ReadLine());
  12.             for (int i = 0; i < linesCount; i++)
  13.             {
  14.                 string temp = Console.ReadLine();
  15.                 if (archive.ContainsKey(temp))
  16.                 {
  17.                     string newName = temp + archive[temp]++;
  18.                     archive.Add(newName, 1);
  19.                     Console.WriteLine(newName);
  20.                 }
  21.                 else
  22.                 {
  23.                     archive.Add(temp, 1);
  24.                     Console.WriteLine("OK");
  25.                 }
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement