Advertisement
NonaG

SortArrayOfStrings

Feb 26th, 2017
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. class SortArrayOfStrings
  8. {
  9. static void Main()
  10. {
  11. var input = Console.ReadLine().Split();
  12. for (int i = 0; i < input.Length; i++)
  13. {
  14. for (int j = i+1; j < input.Length; j++)
  15. {
  16. var greater = string.Compare(input[i],input[j]);
  17. if (greater == 1)
  18. {
  19. var temp = input[i];
  20. input[i] = input[j];
  21. input[j] = temp;
  22. }
  23. }
  24. }
  25. Console.WriteLine(string.Join(" ",input));
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement