BdW44222

Untitled

Jul 23rd, 2021
1,074
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. data = input()
  2. total_strength = 0
  3.  
  4. i = 0
  5. while i < len(data):
  6.     if data[i] == ">":
  7.         strength_of_explosion = int(data[i + 1])
  8.         total_strength += strength_of_explosion
  9.     else:
  10.         # abv>1>1>2>2asdasd
  11.         if total_strength > 0:
  12.             data = data[:i] + data[i + 1:]
  13.             i -= 1
  14.             total_strength -= 1
  15.  
  16.     i += 1
  17.  
  18. print(data)
RAW Paste Data