Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = []
- o = ''
- f = open('input.txt', 'r')
- s = f.readlines()
- for i in range (1, len(s)):
- o = ''
- s[i] = s[i].replace('\n', '')
- if s[i][0] == '+':
- for j in range (2, len(s[i])):
- o += s[i][j]
- m.append(o)
- if s[i][0] == '*':
- if len(m) % 2 == 0:
- for j in range(2, len(s[i])):
- o += s[i][j]
- m.insert(int(len(m) / 2), o)
- else:
- for j in range(2, len(s[i])):
- o += s[i][j]
- m.insert(int(len(m) / 2 + 1), o)
- if s[i][0] == '-':
- print (m[0])
- m.pop(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement