fork(1) download
  1. n=100
  2. while n>=100:
  3. n=int(input('Input:'))
  4. l=[]
  5. ch=[]
  6. al=[]
  7. k=[]
  8. f=[]
  9. count=0
  10. for i in range(0,n):
  11. l.append(raw_input())
  12. for a in l:
  13. for e in list(a):
  14. if ord(e)==41:
  15. count=count+1
  16. elif e!=')':
  17. if count!=0:
  18. k.append(ch.pop(-count-1))
  19. for j in range(0,count):
  20. k.append(ch.pop(-count+j))
  21. for j in range(0,count):
  22. k.append(al.pop())
  23. count=0
  24. if (41<ord(e)<48 or ord(e)==94) and ord(e)!=46:
  25. al.append(e)
  26. elif ord(e)!=40:
  27. ch.append(e)
  28. al.reverse()
  29. if count!=0:
  30. for j in ch:
  31. k.append(j)
  32. for j in al:
  33. k.append(j)
  34. f.append(''.join(k))
  35. count=0
  36. k=[]
  37. al=[]
  38. ch=[]
  39. for i in f:
  40. print i
Runtime error #stdin #stdout #stderr 0.01s 7732KB
stdin
Standard input is empty
stdout
Input:
stderr
Traceback (most recent call last):
  File "prog.py", line 3, in <module>
    n=int(input('Input:'))
EOFError: EOF when reading a line