Advertisement
Guest User

Untitled

a guest
May 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 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 arrsesc
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var input = Console.ReadLine()
  14. .Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)
  15. .Select(int.Parse)
  16. .ToArray();
  17. int rows = input[0];
  18. int cols = input[1];
  19. char[,] arr = new char[rows, cols];
  20. string wordinput = Console.ReadLine();
  21. var word = new Queue<char>();
  22. foreach (var item in wordinput)
  23. {
  24. word.Enqueue(item);
  25. }
  26.  
  27. for (int row = 0; row < rows; row++)
  28. {
  29. for (int col = 0; col < cols; col++)
  30. {
  31. char b = word.Peek();
  32. word.Enqueue(word.Dequeue());
  33. arr[row, col] = b;
  34. }
  35. }
  36. for (int row = 0; row < rows; row++)
  37. {
  38. for (int col = 0; col < cols; col++)
  39. {
  40. Console.Write(arr[row,col]);
  41. }
  42. Console.WriteLine();
  43. }
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement