defsolution(N): # write your code in Python 2.7 if (N > 2147483647or N < 1): return0 s = bin(N)[2:] last = s.__len__()-1 while (s[last] == '0'): last -= 1 s = s[0:last+1] count = 0 max = 0 for c in s: if (c == '0'): count += 1 if (count > max): max = count else: count = 0 returnmax