Thursday, May 24, 2018

STRHH - Half of the half : Basics

#The solution in Python 3 is as follows:

a = []
t = int(input())                     #No. of test cases
i=0
while i<t:
    r = input()
    a.append(r)                      #store the strings in a list
    i+=1
for j in a:
    k=0
    while(k<(len(j)//2)):          #continue loop till half of the string.
        print(j[k],end='')            #Print every second character.
        k+=2
    print()



#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!