I'm looking for a more elegant solutions of this task.
Task: Given a string, print its even-indexed and odd-indexed characters as space-separated strings on a single line.
Input Format: The first line contains an integer (the number of test cases). Each line of the subsequent lines contain a string.
puts "Input a number of test cases"
t = gets.to_i
t.times do
puts "Input a string please"
s = gets.strip
z = s.split(//)
b = z.each_with_index.sort_by { |i, x| [x.even? ? 0 : 1, x] }
b.map { |i, x| print i if x.even? }
print " "
b.map { |i, x| print i if x.odd? }
puts
end