Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _03_boomingCount
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] numbers = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int n = numbers[0];
- int m = numbers[1];
- string input = Console.ReadLine();
- int remove = input.IndexOf("\\<<<");
- if(remove == -1)
- {
- }
- else
- {
- string[] field = input
- .Substring(remove)
- .Split(new string[] { "\\<<<" }, StringSplitOptions.RemoveEmptyEntries)
- .ToArray();
- List<string> destroyed = new List<string>();
- foreach (var canon in field)
- {
- if (n <= canon.Length - 1)
- {
- int length = n + m;
- if (length > canon.Length)
- {
- string currDestroyed = canon.Substring(n, canon.Length - n);
- destroyed.Add(currDestroyed);
- }
- else
- {
- string currDestroyed = canon.Substring(n, m);
- destroyed.Add(currDestroyed);
- }
- }
- }
- Console.WriteLine(string.Join("/\\", destroyed));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement