LoginSignup
1
0

More than 5 years have passed since last update.

CodeEval - Swap Numbers

Posted at

Swap Numbers - CodeEval
汚い。

swap_numbers.rb
File.open(ARGV[0]).each_line {|line|
    input_line = line.chomp.split(" ")
    output_line = []
    input_line.each{|word|
        swap     = word.dup
        swap[0]  = word[-1]
        swap[-1] = word[0]
        output_line << swap
    }
    puts output_line.join(" ")
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0