fork download
  1. tc=int(input())
  2. while(tc!=0):
  3. cnt=0
  4. a=int(input(),2)
  5. b=int(input(),2)
  6. while(b>0):
  7. cnt=cnt+1
  8. u = a^b
  9. v = a&b
  10. a = u
  11. b = v*2
  12. tc-=1
  13. print(cnt)
Success #stdin #stdout 0.03s 9204KB
stdin
1
111
001
stdout
4