fork(1) download
  1. import sys
  2.  
  3. string=sys.stdin.readline()
  4.  
  5. x = list(map(int, sys.stdin.read().split()))
  6. it = iter(x)
  7. q = it.next()
  8. upper = [0]*(100000 + 1)
  9. down = [0]*(100000 + 1)
  10. for i in range(q):
  11. l, r = it.next(), it.next()
  12. if (l > r):
  13. l, r = r, l
  14. upper[l - 1] += 1
  15. down[r] += 1
  16.  
  17. c = 0
  18. i = 0
  19. for char in string:
  20. c +=(upper[i]-down[i])
  21. if c % 2 == 1:
  22. sys.stdout.write(char.swapcase())
  23. else:
  24. sys.stdout.write(char)
  25. i += 1
Runtime error #stdin #stdout #stderr 0.01s 27704KB
stdin
fasgasfasf
1
1 1
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 7, in <module>
AttributeError: 'list_iterator' object has no attribute 'next'