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 ConsoleApplication1
- {
- class ConsoleApplication1
- {
- static void Main(string[] args)
- {
- string p = Console.ReadLine();
- char[] array = p.ToCharArray();
- int numberElements = array.Length;
- int widthTable = int.Parse(Console.ReadLine());
- int height = (numberElements / widthTable) + 1;
- int numberOfTheArray = 0;
- string bombardedPositions = Console.ReadLine();
- string[] numbers = bombardedPositions.Split(' ');
- double positionToBeRemoved = 0;
- int[] bombardInt = bombardedPositions.Split(' ').Select(int.Parse).ToArray();
- bool b = false;
- string m = string.Empty;
- for (int i = 0; i < height; i++)
- {
- for (int j = 0; j < widthTable; j++)
- {
- if (bombardInt.Contains(j))
- {
- if (array[numberOfTheArray + 1] == ' ')
- {
- if (i == 0)
- {
- numberOfTheArray++;
- Console.Write(" ");
- m += " ";
- continue;
- }
- else
- {
- bombardInt = bombardInt.Except(new int[] { j }).ToArray();
- m += " ";
- }
- }
- else
- {
- numberOfTheArray++;
- Console.Write(" ");
- m += " ";
- continue;
- }
- }
- if (i == 0 && j == 0)
- {
- Console.Write(array[0]);
- m += array[0];
- }
- else
- {
- numberOfTheArray += 1;
- if (numberOfTheArray < array.Length)
- {
- Console.Write(array[numberOfTheArray]);
- m += array[numberOfTheArray];
- }
- else
- {
- Console.Write(" ");
- m += " ";
- }
- }
- }
- Console.WriteLine();
- }
- Console.WriteLine(m);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment