以下の内容はhttps://rochefort.hatenablog.com/entry/2014/07/30/074000より取得しました。


CAPITALIZE WORDS(CodeEval)

CHALLENGE DESCRIPTION:

Write a program which capitalizes the first letter of each word in a sentence.

INPUT SAMPLE:

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

Hello world
javaScript language
a letter
1st thing

OUTPUT SAMPLE:

Hello World
JavaScript Language
A Letter
1st Thing

My Code

#!/usr/bin/env ruby -w

def capitalize_word(word)
  word[0].capitalize + word[1..-1]
end

ARGF.each_line do |line|
  puts line.chomp.split.map { |word| capitalize_word(word) }.join(' ')
end



以上の内容はhttps://rochefort.hatenablog.com/entry/2014/07/30/074000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14