optybg

Untitled

Jun 22nd, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace _02StudentsByFirstAndLastName
  6. {
  7.     public class StudentsByFirstAndLastName
  8.     {
  9.         public static void Main()
  10.         {
  11.             var input = Console.ReadLine();
  12.  
  13.             while (input != "END")
  14.             {
  15.                 var name = input
  16.                     .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
  17.                     .Aggregate((a, b) => a.CompareTo(b) < 0 ? $"{a} {b}" : null);
  18.  
  19.                 if (name != null) Console.WriteLine(name);
  20.                 input = Console.ReadLine();
  21.             }
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment