Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace String_Explosion
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- int strength = 0;
- int i = 0;
- int lengthOfString = input.Length;
- while (i < lengthOfString)
- {
- if (input[i] == '>')
- {
- strength = int.Parse(input[i + 1].ToString());
- if (strength == 1)
- {
- input.Remove(i + 1);
- i++;
- }
- else
- {
- for (int j = 0; j < i + strength; j++)
- {
- if (input[j] != '>')
- {
- input.Remove(j);
- }
- else
- {
- i += j;
- }
- }
- }
- }
- else
- {
- i++;
- }
- }
- Console.WriteLine(input);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement