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