p h = "142324312431".split(//) h = h.each_slice(4).map(&:sort).flatten p h
Standard input is empty
["1", "4", "2", "3", "2", "4", "3", "1", "2", "4", "3", "1"] ["1", "2", "3", "4", "1", "2", "3", "4", "1", "2", "3", "4"]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!