読者です 読者をやめる 読者になる 読者になる

SWAP CASE(CodeEval)

CHALLENGE DESCRIPTION:

Write a program which swaps letters' case in a sentence. All non-letter characters should remain the same.

INPUT SAMPLE:

Your program should accept as its first argument a path to a filename. Input example is the following

Hello world!
JavaScript language 1.8
A letter

OUTPUT SAMPLE:

Print results in the following way.

hELLO WORLD!
jAVAsCRIPT LANGUAGE 1.8
a LETTER

My Code

#!/usr/bin/env ruby -w

ARGF.each_line do |line|
  puts line.chomp.swapcase
end