petyaminkova91

Untitled

Nov 22nd, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _07_StringExplosion
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. // abv>>>>dasd
  10.  
  11. string input = Console.ReadLine();
  12.  
  13. string[] splitedInput = input.Split(">");
  14.  
  15. string result = splitedInput[0];
  16. int extraPower = 0;
  17.  
  18. for (int i = 1; i < splitedInput.Length; i++)
  19. {
  20. result += ">";
  21. int power = int.Parse(splitedInput[i][0].ToString()) + extraPower;
  22.  
  23. if (power > splitedInput[i].Length)
  24. {
  25. extraPower = power - splitedInput[i].Length;
  26. }
  27. else
  28. {
  29. result += splitedInput[i].Substring(power);
  30. }
  31. }
  32.  
  33. Console.WriteLine(result);
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment