JuliaPetkova

Untitled

Jun 13th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. char[] arr1 = Console.ReadLine().Split().Select(char.Parse).ToArray();
  2. char[] arr2 = Console.ReadLine().Split().Select(char.Parse).ToArray();
  3.  
  4. int minLength = Math.Min(arr1.Length, arr2.Length);
  5. // int maxLength = Math.Max(arr1.Length, arr2.Length);
  6.  
  7. if (arr1.Length > arr2.Length)
  8. {
  9. Console.WriteLine(string.Join("", arr1));
  10. Console.WriteLine(string.Join("", arr2));
  11. }
  12. else if (arr1.Length < arr2.Length)
  13. {
  14. Console.WriteLine(string.Join("", arr2));
  15. Console.WriteLine(string.Join("", arr1));
  16. }
  17. else
  18. {
  19. for (int i = 0; i < minLength; i++)
  20. {
  21. if (arr1[i] < arr2[i])
  22. {
  23. Console.WriteLine(string.Join("", arr1));
  24. Console.WriteLine(string.Join("", arr2));
  25. break;
  26. }
  27. else
  28. {
  29. Console.WriteLine(string.Join("", arr2));
  30. Console.WriteLine(string.Join("", arr1));
  31. break;
  32. }
  33. }
  34. }
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment