CamelCase in Ruby

Example for versions Ruby 1.9

This works in a same way as this example, but scan extracts the matches of regular expression instead of discarding them and extracting parts of string between them, as split does.

puts gets.chomp.scan( /[a-zA-Z]+/ ).map {|w| w.capitalize}.join