Advertisement
krutzz

Untitled

Dec 9th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Task3
  4. {
  5.     class Task3
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int s;
  10.             int i = 1;
  11.             string result="";
  12.             while (int.TryParse(Console.ReadLine(),out s))
  13.             {
  14.                 int e = int.Parse(Console.ReadLine());
  15.                 string line = Console.ReadLine();
  16.                 int movPos;
  17.                 if (i % 2 == 0)
  18.                 {
  19.                     movPos = 4;
  20.                 }else
  21.                 {
  22.                     movPos = 3;
  23.                 }
  24.                 if (s < 0)
  25.                 {
  26.                     s += line.Length;
  27.                 }
  28.                 if (e < 0)
  29.                 {
  30.                     e += line.Length;
  31.                 }
  32.                 while (s <= e)
  33.                 {
  34.                     result+=line[s];
  35.                     s += movPos;
  36.                 }
  37.                 i++;
  38.             }
  39.             Console.WriteLine(result);
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement