Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication6
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] input = Console.ReadLine().Split(' ');
- List<string> listInput = new List<string>();
- listInput = input.ToList();
- int count = listInput.Count;
- int checker = 0;
- while (count > 0)
- {
- List<string> currentWord = new List<string>();
- string word = listInput[0];
- listInput.RemoveAt(0);
- currentWord.Add(word);
- for (int i = 0; i < listInput.Count; i++)
- {
- if (word == listInput[i])
- {
- currentWord.Add(listInput[i]);
- listInput.RemoveAt(i);
- i--;
- }
- }
- count -= currentWord.Count;
- foreach (var item in currentWord)
- {
- Console.Write(item + " ");
- }
- Console.WriteLine();
- checker++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment