Advertisement
Guest User

Untitled

a guest
Jun 13th, 2018
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.22 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace _03.CameraView
  7. {
  8.     class CameraView
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int[] tokens = Console.ReadLine()
  13.                 .Split()
  14.                 .Select(int.Parse)
  15.                 .ToArray();
  16.             int skip = tokens[0];
  17.             int take = tokens[1];
  18.             List<string> result = new List<string>();
  19.             string input = Console.ReadLine();
  20.             for (int i = 0; i < input.Length - 1; i++)
  21.             {
  22.                 if (input[i] == '|' && input[i + 1] == '<')
  23.                 {
  24.                     StringBuilder picture = new StringBuilder();
  25.                     for (int j = i + 2 + skip;j<input.Length&& j < i + 2 + skip + take; j++)
  26.                     {
  27.                         if (input[j] == '|' && input[j + 1] == '<')
  28.                         {
  29.                             break;
  30.                         }
  31.                         picture.Append(input[j]);
  32.                     }
  33.                     result.Add(picture.ToString());
  34.                 }
  35.             }
  36.             Console.WriteLine(string.Join(", ", result));
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement