Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace MAR02
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             var inputStrings = new SortedSet<string>();
  12.             for(string inputString; !string.IsNullOrWhiteSpace(inputString = Console.ReadLine());)
  13.             {
  14.                 inputStrings.Add(inputString);
  15.             }
  16.             Console.WriteLine(inputStrings.Count);
  17.             foreach (var item in inputStrings.Select((elem, index) => new { index, elem}))
  18.             {
  19.                 Console.WriteLine($"{item.index+1}. {item.elem}");
  20.             }
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement