Advertisement
Guest User

Untitled

a guest
Sep 17th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Problem_04b
  6. {
  7.     class Program
  8.     {
  9.         static void Main()
  10.         {
  11.             //Alternate Solution
  12.             string[] inputElements = Console.ReadLine().Split(' ').ToArray();
  13.  
  14.             for (int i = 0; i < inputElements.Length; i++)
  15.             {
  16.                 Console.Write(inputElements[i]);
  17.                 if (i < inputElements.Length-1 && (inputElements[i] == inputElements[i+1]))
  18.                 {
  19.                     Console.Write(" ");
  20.                 }
  21.                 else
  22.                 {
  23.                     Console.WriteLine();
  24.                 }
  25.             }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement