Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nums = [float(item) for item in input().split(" ")]
- i = 0
- while i != len(nums):
- if len(nums) == 1:
- break
- f = nums[i - 1]
- s = nums[i]
- if f == s:
- nums[i] = f + s
- nums.remove(nums[i - 1])
- i = 0
- i += 1
- if len(nums) <= 1:
- print(nums[0])
- else:
- print(" ".join(map(str, nums)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement