Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. def test(enter):
  2. x = enter[:len(enter)//2];y = enter[len(enter)//2:]
  3. xb = 0
  4. xc = 0
  5. for index in x:
  6. xb = xb + int(index)
  7. for index in y:
  8. xc = xc + int(index)
  9. z = xb - xc
  10. y = xc - xb
  11.  
  12.  
  13. if z == 1 or y == 1:
  14. return "Yes"
  15. else:
  16. return "No"
  17.  
  18. Fin = open("INPUT.txt", "r")
  19. Fout = open ( "OUTPUT.txt", "w")
  20.  
  21. Finput = Fin.read().split()
  22. k = int(Finput[0])
  23. i = 1
  24. while i <= k:
  25. Fout.write(test(Finput[i])+'\n')
  26. i+= 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement