This is a relatively quick one, but I'm sure you'll like it.
Codegolf a program that will take input in the form of a sentence and then provide the output with the first letter capitalized in each word.
Rules:
Submissions may not be in the form of a function. So no:
function x(y){z=some_kind_of_magic(y);return z;}
as your final answer... Your code must show that it takes input, and provides output.The code must preserve any other capital letters the input has. So
eCommerce and eBusiness are cool, don't you agree, Richard III?
will be rendered as
ECommerce And EBusiness Are Cool, Don't You Agree, Richard III?
Some of you may be thinking, "Easy, I'll just use regex!" and so using the native regex in your chosen golfing language will incur a 30 character penalty which will be applied to your final code count. Evil laugh
A "word" in this case is anything separated by a space. Therefore
palate cleanser
is two words, whereaspigeon-toed
is considered one word.if_you_love_her_then_you_should_put_a_ring_on_it
is considered one word. If a word starts with a non-alphabetical character, the word is preserved, so_this
after rendering remains as_this
. (Kudos to Martin Buttner for pointing this test case out).- 4b. There is no guarantee that words in the input phrase will be separated by a single space.
Test Case, (please use to test your code):
Input:
eCommerce rocks. crazyCamelCase stuff. _those pigeon-toed shennanigans. Fiery trailblazing 345 thirty-two Roger. The quick brown fox jumped over the lazy dogs. Clancy Brown would have been cool as Lex Luthor. good_bye
Output:
ECommerce Rocks. CrazyCamelCase Stuff. _those Pigeon-toed Shennanigans. Fiery Trailblazing 345 Thirty-two Roger. The Quick Brown Fox Jumped Over The Lazy Dogs. Clancy Brown Would Have Been Cool As Lex Luthor. Good_bye
This is code golf, shortest code wins...
Good luck...