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.Text.RegularExpressions;
- using System.Threading.Tasks;
- namespace _03CameraView
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] nums = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int skip = nums[0];
- int take = nums[1];
- string pattern = @"(?!\|)<(?<pics>[a-zA-Z]*)";
- string input = Console.ReadLine();
- MatchCollection matchedResult = Regex.Matches(input, pattern);
- List<string> res = new List<string>();
- foreach (Match m in matchedResult)
- {
- res.Add(m.Groups["pics"].Value);
- }
- List<string> result = new List<string>();
- for (int i = 0; i < res.Count; i++)
- {
- if (res[i].Length <= skip)
- {
- continue;
- }
- else if (res[i].Length >= skip + take)
- {
- result.Add(res[i].Substring(skip, take));
- }
- else
- {
- result.Add(res[i].Remove(0, skip));
- }
- }
- Console.WriteLine(string.Join(", ", result));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment