Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a, b, c = map(str, input().split())
- x, y = str, str
- s = str(a + '+' + b + '*x' + '+' + c + '*y')
- s1 = s.replace('1', '').replace('0*x', '').replace('0*y', '').replace('+-', '-').replace('+ a', 'a').replace('*', '').replace('0', '').replace('-+','-').replace('+-', '-').replace('++', '+').replace('--','+')
- if s1.count('+') != 0:
- if s1.index('+') == 0:
- s1 = s1[1:]
- if s1.count('+') != 0:
- if s1.rindex('+') == len(s1)-1:
- s1 = s1[:-1]
- if s1.count('-') != 0:
- if s1.index('-') == 0:
- s1 = s1[1:]
- print(s1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement