Advertisement
MilenaPetkanova

CameraRow

Oct 28th, 2017
746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class CameraView
  5. {
  6. static void Main()
  7. {
  8. var skipTake = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  9. int skip = skipTake[0];
  10. int take = skipTake[1];
  11.  
  12. string picture = Console.ReadLine();
  13. string pattern = @"|<";
  14.  
  15. string[] cameras = picture.Split(pattern);
  16.  
  17. for (int i = 1; i < cameras.Length; i++)
  18. {
  19. string camera = cameras[i];
  20. string view = new string(camera.Skip(skip).Take(take).ToArray());
  21.  
  22. if (i== 1)
  23. {
  24. Console.Write("{0}", view);
  25. continue;
  26. }
  27. Console.Write(", {0}", view);
  28. }
  29. Console.WriteLine();
  30.  
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement