Advertisement
YavorGrancharov

Compare_Char_Arrays

Oct 13th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace Compare_Char_Arrays
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             string[] first = Console.ReadLine().Split(' ').ToArray();
  11.             char[] charsFirst = string.Join(string.Empty, first).ToCharArray();
  12.  
  13.             string[] second = Console.ReadLine().Split(' ').ToArray();
  14.             char[] charsSecond = string.Join(string.Empty, second).ToCharArray();
  15.  
  16.             if (charsFirst.Length == charsSecond.Length)
  17.             {
  18.                 if (charsFirst[0] - '0' < charsSecond[0] - '0')
  19.                 {
  20.                     Console.WriteLine(string.Join("", charsFirst));
  21.                     Console.WriteLine(string.Join("", charsSecond));
  22.                 }
  23.                 else
  24.                 {
  25.                     Console.WriteLine(string.Join("", charsSecond));
  26.                     Console.WriteLine(string.Join("", charsFirst));
  27.                 }
  28.             }
  29.             else if (charsFirst.Length > charsSecond.Length)
  30.             {
  31.                 Console.WriteLine(string.Join("", charsSecond));
  32.                 Console.WriteLine(string.Join("", charsFirst));
  33.             }
  34.             else
  35.             {
  36.                 Console.WriteLine(string.Join("", charsFirst));
  37.                 Console.WriteLine(string.Join("", charsSecond));
  38.             }
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement