Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace Practice
- {
- class Program
- {
- static void Main(string[] args)
- {
- char[] arr1 = Console.ReadLine().Split(' ').Select(char.Parse).ToArray();
- char[] arr2 = Console.ReadLine().Split(' ').Select(char.Parse).ToArray();
- bool eql = true;
- int smallerLenght = Math.Min(arr1.Length, arr2.Length);
- int i = 0;
- while (eql)
- {
- if (i == smallerLenght - 1 && eql)
- {
- if (arr1.Length<arr2.Length)
- {
- Console.WriteLine(string.Join("", arr1));
- Console.WriteLine(string.Join("", arr2));
- }
- else
- {
- Console.WriteLine(string.Join("", arr2));
- Console.WriteLine(string.Join("", arr1));
- }
- break;
- }
- if (arr1[i]==arr2[i])
- {
- i++;
- }
- else if (arr1[i]>arr2[i])
- {
- Console.WriteLine(string.Join("",arr2));
- Console.WriteLine(string.Join("",arr1));
- eql = false;
- }
- else
- {
- Console.WriteLine(string.Join("", arr1));
- Console.WriteLine(string.Join("", arr2));
- eql = false;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment