We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
the ruby code did not work so I did modifications in the end
# Enter your code here. Read input from STDIN. Print output to STDOUTgets.to_i.timesdo# s will split every input on a line so we do not need to worry about wordss=gets.chomp.split('')# we make a hash dictionarry with 2 lists for even and odd positionsparts={0=>"",1=>""}# use the index position of each letter to determine on with hash dicionarry to place its.each_with_indexdo|char,index|parts[index%2]<<charend# e' Finitoooo! :Dputsparts[0]+" "+parts[1]end
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Join us
Create a HackerRank account
Be part of a 26 million-strong community of developers
Please signup or login in order to view this challenge
Day 6: Let's Review
You are viewing a single comment's thread. Return to all comments →
the ruby code did not work so I did modifications in the end