Advertisement
Aborigenius

BoomingCannonCheated

Aug 27th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using System.Threading.Tasks;
  7.  
  8. namespace BoomingCannon
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             string[] inputN = Console.ReadLine().Split(' ').ToArray();
  15.             int distance = int.Parse(inputN[0]);
  16.             int countToDestroy = int.Parse(inputN[1]);
  17.  
  18.             string pattern = @"(?<=\\<<<)(?<words>\w+)";
  19.             Regex getWord = new Regex(pattern);
  20.             string inputTargets = Console.ReadLine();
  21.  
  22.             string[] targets = Regex.Split(inputTargets, pattern);
  23.             var result = new List<char>();
  24.             var result2 = new List<char>();
  25.             for (int index = 1; index < targets.Length; index += 2)
  26.             {
  27.                 string t = targets[index];
  28.                 if (index == 1)
  29.                 {
  30.                      result = t.Skip(distance).Take(countToDestroy).ToList();
  31.                 }
  32.                 else
  33.                 {
  34.                      result2 = t.Skip(distance).Take(countToDestroy).ToList();
  35.                 }
  36.  
  37.            
  38.             }
  39.  
  40.             foreach (var item in result)
  41.             {
  42.                 Console.Write(item);
  43.             }
  44.             if (result2.Count > 0)
  45.             {
  46.                 Console.Write("/\\");
  47.             }
  48.  
  49.             foreach (var item in result2)
  50.             {
  51.                 Console.Write(item);
  52.             }
  53.  
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement