<commit_before><commit_msg>https://www.hackerrank.com/challenges/two-two/problem initial commit with time outs<commit_after># https://www.hackerrank.com/challenges/two-two/problem
# def substrings(word):
#     length=len(word)
#     for i in range(length):
#         for j in range(i,length):
#             #print("i:{0} and j:{1}".format(i,j))
#             print(word[i:j+1])
def getpowersoftwo():
    powerset=set()
    for i in range(1,800,1):
        powerset.add(pow(2,i))
    return powerset

def check_all_substrings(powerset, input_string):
    if input_string[0] == "0":
        # print("removing for {0}".format(input_string))
        input_string=input_string.replace("0", "")
        # print(input_string)
    count=0
    length = len(input_string)
    for i in range(length):
        for j in range(i,length):
            # print(input_string[i:j + 1])

            if int(input_string[i:j + 1]) in powerset:
                # print("{0} eisxt".format(int(input_string[i:j + 1])))
                count+=1
            # else:
                # print("{0} not eisxt".format(input_string[i:j + 1]))
    print(count)
    # print(powerset)
    # print("2" in powerset)



T=int(input())
# print(T)
# list=[]
temp=''
powerset=getpowersoftwo()
for i in range(T):
    temp=input()
    check_all_substrings(powerset,temp)
    # list.append(input())


# substrings(list[0])
# print("Coming here")



def get_all_substrings(input_string):
  length = len(input_string)
  return [input_string[i:j+1] for i in range(length) for j in range(i,length)]

# print(get_all_substrings('abcde'))
{'fraction_non_alphanumeric': 0.1580604534005038, 'fraction_numerical': 0.015113350125944584, 'mean_word_length': 3.1059431524547803, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7556810', 'n_tokens_mistral': 585, 'n_tokens_neox': 560, 'n_words': 105}