whitestarrr

5

Jan 31st, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. class CompareCharArrays
  4. {
  5. static void Main()
  6. {
  7. char[] first = Console.ReadLine().Split(' ').Select(char.Parse).ToArray();
  8. char[] second = Console.ReadLine().Split(' ').Select(char.Parse).ToArray();
  9.  
  10. if (first.Length < second.Length)
  11. {
  12. Console.WriteLine("{0}\n{1}", string.Join("", first), string.Join("", second));
  13. }
  14. else if (first.Length > second.Length)
  15. {
  16. Console.WriteLine("{0}\n{1}", string.Join("", second), string.Join("", first));
  17. }
  18. else if (first.Length == second.Length)
  19. {
  20. for (int i = 0; i < Math.Min(first.Length, second.Length); i++)
  21. {
  22.  
  23. if (first[i] > second[i])
  24. {
  25. Console.WriteLine("{0}\n{1}", string.Join("", second), string.Join("", first));
  26. break;
  27. }
  28. if (second[i] > first[i])
  29. {
  30. Console.WriteLine("{0}\n{1}", string.Join("", first), string.Join("", second));
  31. break;
  32. }
  33. if (second[i] == first[i])
  34. {
  35. Console.WriteLine("{0}\n{1}", string.Join("", first), string.Join("", second));
  36. break;
  37. }
  38. }
  39. }
  40. }
  41. }
Add Comment
Please, Sign In to add comment