Advertisement
raziel13

string_ex_07_string_explosion

Dec 14th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _07_string_explosion//100/100
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string input = Console.ReadLine();
  14.             int strenght = 0;
  15.  
  16.             for (int i = 0; i < input.Length; i++)
  17.             {
  18.                 char symbol = input[i];
  19.                 if (symbol == '>')
  20.                 {
  21.                     strenght += int.Parse(input[i +1].ToString());
  22.                     continue;
  23.                 }
  24.                 if (strenght > 0)
  25.                 {
  26.                   input = input.Remove(i, 1);
  27.                     i--;
  28.                     strenght--;
  29.  
  30.                 }
  31.             }
  32.             Console.WriteLine(input);
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement