TASK : Given a string, S, of length N that is indexed from 1 to N-1 , print its even-indexed and odd-indexed characters as space-separated strings on a single line
Note: 0 is considered even string.
Sample Input 2 Hacker Rank Sample Output Hce akr Rn ak
Solution (Python):
T=input() for t in range (0,T): word=raw_input() listing=list(word) even=[] odd=[] for i in range (0,len(listing)): if i==0 or i%2==0: even.append(listing[i]) else: odd.append(listing[i]) print''.join(even),''.join(odd)