Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 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. namespace TestDemo
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. List<string> textLines = new List<string>();
  14. int n = int.Parse(Console.ReadLine());
  15.  
  16. for (int i = 0; i < n; i++)
  17. {
  18. string input = Console.ReadLine();
  19. textLines.Add(input);
  20. }
  21.  
  22. StringBuilder sb = new StringBuilder();
  23.  
  24. foreach (var line in textLines)
  25. {
  26. string[] currentLine = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  27.  
  28. for (int i = 0; i < currentLine.Length / 2; i++)
  29. {
  30. sb.Append($"{currentLine[i]} ");
  31. }
  32. sb.AppendLine();
  33. for (int i = currentLine.Length / 2; i < currentLine.Length; i++)
  34. {
  35. sb.Append($"{currentLine[i]} ");
  36.  
  37. }
  38. sb.AppendLine();
  39. }
  40. string result = sb.ToString().Trim();
  41. Console.WriteLine(result);
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement