• + 0 comments

    the ruby code did not work so I did modifications in the end

    # Enter your code here. Read input from STDIN. Print output to STDOUT
    gets.to_i.times do
      # s will split every input on a line so we do not need to worry about words
      s = gets.chomp.split('')
      # we make a hash dictionarry with 2 lists for even and odd positions
      parts = {0 => "", 1 => ""}
      # use the index position of each letter to determine on with hash dicionarry to place it
      s.each_with_index do |char, index|
        parts[index%2] << char
      end
      # e' Finitoooo! :D
      puts parts[0] + " " + parts[1]
    end