Advertisement
svetlyoek

Untitled

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