[Question]
  [
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:
1. 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.
2. 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?
```
3. 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*
4. A "word" in this case is anything separated by a space. Therefore `palate cleanser` is two words, whereas `pigeon-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.
5. 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
```
6. This is code golf, shortest code wins...
Good luck... 
  
[Answer]
# CJam, ~~15~~ 13 bytes
```
Lq{_eu?_S-}/;
```
Try it online in the [CJam interpreter](http://cjam.aditsu.net/#code=Lq%7B_eu%3F_S-%7D%2F%3B&input=eCommerce%20rocks.%20crazyCamelCase%20stuff.%20_those%20%20pigeon-toed%20shennanigans.%20Fiery%20trailblazing%20345%20thirty-two%20Roger.%20The%20quick%20brown%20fox%20jumped%20over%20the%20lazy%20dogs.%20Clancy%20Brown%20would%20have%20been%20cool%20as%20Lex%20Luthor.%20good_bye).
### Pseudocode
```
L             e# B := ""
 q            e# Q := input()
  {       }/  e# for C in Q:
   _eu?       e#     C := B ? C : uppercase(C)
       _S-    e#     B := string(C).strip(" ")
            ; e# discard(B)
```
All modified characters C are left on the stack and, therefore, printed when exiting.
[Answer]
# CSS 2.1, 49
```
:after{content:attr(t);text-transform:capitalize}
```
**Explanation**:
* The [`attr`](https://developer.mozilla.org/en-US/docs/Web/CSS/attr) function takes the input from a `t` (text) HTML attribute.
* The input is capitalized by setting [`text-transform`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform) to `capitalize`.
* The output is provided as a generated content, using the [`content`](https://developer.mozilla.org/en-US/docs/Web/CSS/content) property on an [`::after`](https://developer.mozilla.org/en-US/docs/Web/CSS/::after) [pseudo-element](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements).
**Runnable snippet**:
```
:after {
    content: attr(t);
    text-transform: capitalize;
}
```
```
<div t="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"></div>
```
**Note**: [CSS 2.1](http://www.w3.org/TR/CSS1/#text-transform) specified the desired behavior: `capitalize` uppercased the first character of each word. However, [CSS3](http://dev.w3.org/csswg/css-text-3/#text-transform) uppercases first [typographic letter unit](http://dev.w3.org/csswg/css-text-3/#typographic-letter-unit) of each word. So the snippet above won't work properly neither on old IE, which didn't follow CSS 2.1; nor on new compliant browsers which follow CSS3. 
[Answer]
# Perl, 13 bytes
```
perl -040pe '$_="\u$_"'
```
9 bytes plus 4 bytes for `040p` (assuming I've interpreted the [rules on special invocations](http://meta.codegolf.stackexchange.com/a/274/31388) correctly).
`-040` sets the input record separator `$/` to a single space, so spaces are preserved; the `\u` escape sequence converts the next character to title case.
[Answer]
# Javascript (*ES6*), 77 bytes
```
alert(prompt().split(' ').map(x=>x&&x[0].toUpperCase()+x.slice(1)).join(' '))
```
### Commented
```
alert( // output
    prompt(). // take input
    split(' '). // split by spaces
    map(x=> // map function to array
        x && // if x, empty string "" is falsey and returns itself
        x[0].toUpperCase() + x.slice(1) // capaitalize 1st char and concatenate the rest
    ).
    join(' ') // join array with spaces
)
```
[Answer]
# Perl Version < 5.18, 30 27 26 25
```
say map"\u$_",split$,=$"
```
`24` characters `+1` for `-n`.
`\u` makes the next character in a string [uppercase](http://perldoc.perl.org/perlop.html#Quote-and-Quote-like-Operators). @ThisSuitIsBlackNot pointed this out to save 1 byte. Before we were using the function `ucfirst`.
From the [perldocs](http://perldoc.perl.org/functions/split.html),
> 
> As another special case, split emulates the default behavior of the
>  command line tool awk when the PATTERN is either omitted or a literal
>  string composed of a single space character (such as ' ' or "\x20" ,
>  but not e.g. / / ). In this case, any leading whitespace in EXPR is
>  removed before splitting occurs, and the PATTERN is instead treated as
>  if it were /\s+/ ; in particular, this means that any contiguous
>  whitespace (not just a single space character) is used as a separator.
>  However, this special treatment can be avoided by specifying the
>  pattern / / instead of the string " " , thereby allowing only a single
>  space character to be a separator. In earlier Perls this special case
>  was restricted to the use of a plain " " as the pattern argument to
>  split, in Perl 5.18.0 and later this special case is triggered by any
>  expression which evaluates as the simple string " " .
> 
> 
> 
Since `$"` evaluates to a space, this will preserve the spaces. Since we want to both set `$,` to a space character, and input a space character to the split, @nutki pointed out we can do both as the input to the split. That saves 3 bytes from what we had before, which was first setting `$,` and then inputting `$"` to the split.
Using a `,` for map instead of `{}` saves an additional byte, as @alexander-brett pointed out.
Run with:
```
echo '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' | perl -nE'say map"\u$_",split$,=$"'
```
[Answer]
# CJam, ~~17~~ 15 bytes
```
lS/{S+(eu\+}/W<
```
[Test it here.](http://cjam.aditsu.net/#code=lS%2F%7BS%2B(eu%5C%2B%7D%2FW%3C&input=_this%20%20eCommerce%20rocks.%20crazyCamelCase%20stuff.%20_those%20pigeon-toed%20shennanigans.%20Fiery%20trailblazing%20345%20thirty-two%20Roger.%20The%20quick%20brown%20fox%20jumped%20over%20the%20lazy%20dogs.%20Clancy%20Brown%20would%20have%20been%20cool%20as%20Lex%20Luthor.%20good_bye)
Fairly straightforward implementation of the spec. Make use of the new `{}&` to avoid errors for consecutive spaces.
*Two bytes saved by Dennis.*
[Answer]
## C, ~~64~~ 63 bytes
```
a;main(c){while(~(c=getchar()))putchar(a?c:toupper(c)),a=c-32;}
```
*Fix: some compilers (such as Clang) don't like an int parameters in place of argv, so I moved it to a global variable. The byte count stays the same. Thanks to squeamish ossifrage for noticing.*
*Down to 63 bytes, thanks Dennis.*
Ungolfed:
```
int a;
int main(int c) {
    while(~(c = getchar()))
        putchar(a ? c : toupper(c)),
        a = c - ' ';
}
```
Pretty straightforward: if a is false, the character is converted to uppercase. It is set after reading a space: c - ' ' is false only if c == ' '. toupper() ignores everything that is not a lowercase letter, so symbols and multiple spaces are fine. -1 has all bits set, so when getchar() returns -1 the NOT operator makes it zero, and the loop stops.
a is declared as a global variable, so it is initializd to zero (false). This ensures that the first word is capitalized.
[Answer]
# Python 3, ~~59~~ 56 bytes
```
f=1
for c in input():print(end=f*c.upper()or c);f=c==" "
```
Thanks to @Reticality for 3 bytes.
[Answer]
# [><> (Fish)](http://esolangs.org/wiki/Fish), 39 bytes
```
</?-' 'o:;?(0:<-*' '*('{'$)'`'::i
i/.0e
```
Method:
* Take one char and capitalize it if in range `a-z` then print it out. (left-to-right code for this part is `i::'backquote')$'{'(*' '*+`)
* **If** the last taken char is an EOF char **then** exit **else** print it
* **If** the last taken char is a space char **then** go to point 1 **else** take a new letter and go to point 2.
[Answer]
# JAVA, 273 bytes
**EDIT**
```
import static java.lang.System.*;class x{public static void main(String[] s){char[] a=new java.util.Scanner(in).nextLine().toCharArray();boolean f=1>0;for(int i=0;i<a.length;i++){if(a[i]==' '){f=1>0;continue;}if(f){a[i]=Character.toUpperCase(a[i]);f=1<0;}}out.println(a);}}
```
[Answer]
## JavaScript (regex solution) - 104 bytes
Someone has to bite the bullet and post the RegEx solution! 74 characters, plus the +30 character penalty:
```
alert(prompt().replace(/(^| )[a-z]/g,function(m){return m.toUpperCase()}))
```
Or if you want to read and understand the code in its non-compacted fashion:
```
//     Matches the (beginning of the line or a space), followed by a lowercase English character.  
string.replace( /(^| )[a-z]/g ,
                function(match) { return match.toUpperCase(); }
```
[Answer]
# Vim, ~~11~~, 10 bytes
```
qqvUW@qq@q
```
Explanation:
```
qq           #Start recording in register 'q'
  vU        #Make the character under the cursor uppercase
     W       #Move forward a WORD
      @q     #recursively call macro 'q'
        q    #stop recording
         @q  #Call the recursive macro
```
Do I get a gold-badge for [outgolfing Dennis?](http://meta.codegolf.stackexchange.com/questions/5828/the-many-memes-of-ppcg/7346#7346)
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), ~~342~~ 310 bytes
```
>-[-[-<]>>+<]>-[->+>>>>+<<<<<]>[-<+>],[<[->>+>+<<<]>>>[-<<<+>>>]<<[->>+>+<<<]>>>[-<<<+>>>]<<[->-<]>>+<[>->>>+[+[<]>>+<+]>[-<<<<<<->>>>>>]<<<+++++[>+++++<-]>+>>+<<[<<<<[->+>>+<<<]>[-<+>]>>[[-]>>+<<]>>-[<<<[-<<<<->>>>]>>>+>-<]<<<<<->>>>-]>>[-<<<<[-]>>>>]<<<<<<[-]]>[->[-]<<<<<[->>>+>>+<<<<<]>>>[-<<<+>>>]>]<<<.,]
```
[Try it online!](https://tio.run/##fZFNb4MwDIb/iu9puGy7oRyGtFNP025RVAUwHyvEXQht6Z9nTqi6nuYgwhu/fmyg9LZ3zVwd11VJzSs3Sgm@8aMSSkURwyhOCWV2OucEZ0Q6VPE4z6PR5P9n7mStZIRqoTctzGbkiInNnosYWqUtlyZOwlgdXdtc4mkmbqVlgkWk1Mn0AMZRROz@1yOaN0eq21puKjL5Mnedah@f4PmdUk22M@uKBY0j@grBU3WcMqi8vS2FHXEo7IQwhblpMjiEjljBqW@RnAyENUwdOmdd31rHdR89@gUC/5GhHOytdy28vL5B6HofFhkuBJ/Uos/gq0P4mfvqCKWni4OGrvA9jycm0hk9VyAwYIGaWuYWg3XVAu/Je6F5qKGzZ4QS0UFFNICdYI9X2M88I/NbovpQLvgL "brainfuck – Try It Online")
Explanation:
```
[
* Many constants were taken from the BF constants page on esolangs.org.
*
* Cells:
*
* true number: the true index of the cell
* fake number: the relative cell index as referenced in the code
*
* true# | fake# | info
*   0       -     Used only for initialization of (fake) cell 0
*   1       -     Used only for initialization of (fake) cell 0
*   2       -     Used only for initialization of (fake) cell 0
*   3       -     Used only for initialization of (fake) cell 0
*   4       0     Holds constant 32 / ' ', which is used for cell 5 (space flag) and for subtracting (' ') from input
*   5       1     Holds the input/output char during the main loop. Also used in setup for copying cell 0 to cell 5
*   6       2     Used to hold 32 / ' ' (temporarily, to subtract it from the input)
*   7       3     Used to hold a copy of the input that gets mangled throughout the loop, being subtracted from to 
*                 check what the input character was. Also used in space code to copy cell 0 to cell 5.
*   8       4     Used primarily as a flag to decide which part of the space/not space conditional to run (if 1, the 
*                 space code runs; if 0, the not-space code runs). Also used when copying cell 3 to 6 (for checking 
*                 if cell 3 == 0), and to copy cell 1 to 3 (input).
*   9       5     Holds the 'space flag' (different from cell 4). When a space is encountered, this cell is set to 32 
*                 ('a' - 'A'). When a lowercase character is encountered, this cell is subtracted cell 1 (input), 
*                 clearing it by default (subtraction without copying implicitly clears the cell). This makes it so
*                 that only the first character after a space is converted to uppercase.
*   10      6     Used as a temporary cell when initializing constants 65 ('a' - ' ') and 2, also used in the
*                 lowercase check loop to set cell 8 (cell 3 == 0 flag)
*   11      7     Used as the counter in the lowercase check loop, goes from 26 to 0 (decrementing each iteration).
*                 Also used as a temporary cell when initializing constant 65.
*   12      8     Used to hold (cell 3 == 0) flag, which subtracts cell 5 from cell 1 if it is 1 (which means that 
*                 cell 1 is a lowercase letter).
*   13      9     Used as a flag to figure out if the else branch of the lowercase checker should run. If one, the
*                 character is not a lowercase letter or space and so cell 5 is cleared.
]
>-[-[-<]>>+<]>-    set cell 0 to 32 (=' ') 
[->+>>>>+<<<<<]    set cells 1 and 5 to 32 (end on 0)
>[-<+>]            move 1 back to 0 (end on 1) 
,[                 loop over input (cell 1) 
    
    copy cell 0 to cell 2
    <[->>+>+<<<]     [move cell 0 to cells 2 and 3 (end on 0)]
    >>>[-<<<+>>>]    [move cell 3 back to cell 0 (end on 3)] 
    
    copy cell 1 to cell 3
    <<[->>+>+<<<]    [move cell 1 to cells 3 and 4 (end on 1)]
    >>>[-<<<+>>>]    [move cell 4 back to cell 1 (end on 4)] 
    
    <<[->-<]         [subtract cell 2 from cell 3 (end on 2)] 
    
    >                cell 3 / input minus ' ' 
    
    >+<              set cell 4 as flag to run space code if set (end on 3) 
    
    [                not space branch (check if in lowercase zone)
        >-                 clear cell 4 (end on 4) 
        
        >>>+[+[<]>>+<+]>   set cell 9 to 65 (='a' minus ' ') (uses 6 7 8 as tmp) (end on 9) 
        
        [-<<<<<<->>>>>>]   [subtract cell 9 from cell 3 (end on 9)] 
        
        [need to check if cell 3 is from 0-26, it could be above and not a lowercase letter] 
        
        <<<                cell 6
        +++++[>+++++<-]>+  set cell 7 to 26
        >>+<<              set cell 9 to 1 (end on 7) 
        
        [                  do 26 times 
            
            <<<<                   cell 3
            [->+>>+<<<]            [move cell 3 to cell 4 and 6 (end on 3)]
            >[-<+>]                [move cell 4 back to cell 3 (end on 4)] 
            
            >>                     cell 6 
            
            [[-]>>+<<]             [if cell 6 is set, set cell 8 to 1 (end on 6)] 
            
            >>-                    decrement cell 8 (if cell 3 was not zero cell 8 is now zero) (if cell 3 was zero cell 8 is now 255) 
            
            [                      if cell 3 is zero (start here on 8)
                <<<                    cell 5
                [-<<<<->>>>]           [sub cell 5 from cell 1 (end on 5)] 
                
                >>>+                   clear cell 8 (end on 8)
                >-<                    set cell 9 to 0 (end on 8)
            ] 
            
            <<<<<-                 decrement cell 3 (end on 3)
            >>>>-                  end on 7 and decrement
        ] 
        
        >>[                cell 9 set (else branch so we have no lowercase letter)
            -                  [clear cell 9] 
            
            <<<<               cell 5
            [-]                [clear cell 5]
            >>>>               cell 9
        ] 
        
        <<<<<<             cell 3
        [-]                [clear cell 3]
    ] 
    
    >                cell 4
    [                space branch
        -                      clear cell 4 (end on 4)
        
        >[-]                   clear cell 5 (space flag/may have been set)
        <<<<<[->>>+>>+<<<<<]   [set space flag (cell 5) (coincidentally, it is also 32 so we can copy from cell 0) (0-> 5 and 3) (end on 0)]
        >>>[-<<<+>>>]          [3 to 0 (end on 3)] 
        
        >                      end on 4
    ] 
    
    <<<.             from 4 to 1 (output 1)
,]
```
[Answer]
# Python 2, 73 bytes
```
i=raw_input()
print''.join((c,c.upper())[p==' ']for p,c in zip(' '+i,i))
```
This program capitalises a letter if preceded by a space (with a kludge for the first character in the string). It relies on the `.upper()` string method to capitalise correctly.
[Answer]
# PHP 64 ~~76~~ ~~77~~ ~~83~~ ~~84~~ ~~89~~ bytes
Does `$_GET` count as input in PHP?  
If so, here is my first CG attempt
```
foreach(explode(' ',$_GET[@s])as$k=>$v)echo$k?' ':'',ucfirst($v)
```
Thanks manatwork :)
One could just use the `ucwords` function, which would result in 21 bytes:
```
<?=ucwords($_GET[@s])
```
thanks Harry Mustoe-Playfair :)
[Answer]
# Haskell, 69
```
import Data.Char
main=interact$tail.scanl(!)' '
' '!c=toUpper c;_!c=c
```
### Explanation:
`scanl` takes a function `(a -> b -> a)` and an initial value `a`, then iterates over a list of `[b]`s to make a list of `[a]`s:
```
scanl (!) z [a,b,c] == [   z
                       ,   z ! a
                       ,  (z ! a) ! b
                       , ((z ! a) ! b) ! c]
```
It repeatedly takes the **previous result** as the **left argument** of the function passed to it, and a **value from the input list** as the **right argument**, to make the next one.
I wrote a function `(!) :: Char -> Char -> Char` that returns the right character you pass it, but capitalizes it if the left char is `' '` (space). For `scanl`, this means: return the **value from the input list**, but capitalize it if the **previous result** was a space. So `scanl (!) ' ' "ab cd"` becomes:
```
    scanl (!) ' ' "ab cd"
==> ' ' : scanl (!) (' ' ! 'a') "b cd"
==> ' ' : scanl (!)     'A'     "b cd"
==> ' ' : 'A' : scanl (!) ('A' ! 'b') " cd"
==> ' ' : 'A' : scanl (!)     'b'     " cd"
==> ' ' : 'A' : 'b' : scanl (!) ('b' ! ' ') "cd"
==> ' ' : 'A' : 'b' : scanl (!)     ' '     "cd"
==> ' ' : 'A' : 'b' : ' ' : scanl (!) (' ' ! 'c') "d"
==> ' ' : 'A' : 'b' : ' ' : scanl (!)     'C'     "d"
==> ' ' : 'A' : 'b' : ' ' : 'C' : scanl (!) ('C' ! 'd') ""
==> ' ' : 'A' : 'b' : ' ' : 'C' : scanl (!)     'd'     ""
==> ' ' : 'A' : 'b' : ' ' : 'C' : 'd' : ""
==> " Ab Cd"
```
We need the initial value `' '` to capitalize the first letter, but then we chop it off with `tail` to get our final result.
[Answer]
# Pyth, 20 bytes
```
uXGHr@GH1fqd@+dzTUzz
```
These multiple spaces really sucks. Otherwise there would have been a really easy 12 bytes solution. 
Try it online: [Pyth Compiler/Executor](https://pyth.herokuapp.com/?code=uXGHr%40GH1fqd%40%2BdzTUzz&input=eCommerce%20rocks.%20crazyCamelCase%20stuff.%20_those%20%20pigeon-toed%20shennanigans.%20Fiery%20trailblazing%20345%20thirty-two%20Roger.%20The%20quick%20brown%20fox%20jumped%20over%20the%20lazy%20dogs.%20Clancy%20Brown%20would%20have%20been%20cool%20as%20Lex%20Luthor.%20good_bye&debug=0)
### Explanation
```
                      implicit: z = input string
         f       Uz   filter [0, 1, 2, ..., len(z)-1] for elements T, which satisfy:
          qd@+dzT        " " == (" " + z)[T]
                      (this finds all indices, which should be capitalized)
u                  z  reduce, start with G = z, for H in idices ^ update G by
 XGH                     replace the Hth char of G by
    r   1                upper-case of
     @GH                 G[H]
                      implicitly print result
```
edit: 16 chars is possible with @Dennis algorithm. 
[Answer]
# CJam, 14 bytes
It's not the shortest, but...
```
qS/Sf.{\eu}s1>
```
Another answer using similar ideas:
```
qS/Laf.{;eu}S*
```
`.x` only changes the first item if one of the parameters has only one item.
[Answer]
# Lua, ~~64~~ ~~62~~ 61 bytes
Lua is a horrendous language to golf in, so I'm pretty proud of myself for this one.
```
print(string.gsub(" "..io.read(),"%s%l",string.upper):sub(2))
```
~~[Try it here]~~[1](http://goo.gl/TouhWJ) Outdated, will update tommorow
[Answer]
# JAVA, 204 ~~211~~ ~~226~~ bytes
My first entry on CG, I hope it's fine:
```
class U{public static void main(String[]s){int i=0;char[]r=s[0].toCharArray();r[0]=Character.toUpperCase(r[0]);for(char c:r){if(c==' '&&i>0)r[i+1]=Character.toUpperCase(r[i+1]);i++;System.out.print(c);}}}
```
Saved 7 bytes thanks to @TNT
[Answer]
# PHP: ~~76~~ 74 characters
```
foreach($l=str_split(fgets(STDIN))as$c){echo$l?ucfirst($c):$c;$l=$c==" ";}
```
Sample run:
```
bash-4.3$ php -r 'foreach($l=str_split(fgets(STDIN))as$c){echo$l?ucfirst($c):$c;$l=$c==" ";}' <<< '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'
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
```
[Answer]
# C, 74 bytes
```
a,b=1;main(){while((a=getchar())>0)b=isspace(putchar(b?toupper(a):a));}
```
Makes no assumptions about the run-time character set (ASCII, EBCDIC, Baudot, ...whatever). Does assume that EOF is negative (I think C guarantees that).
```
a,b=1;
main()
{
    while((a=getchar())>0)
        b=isspace(putchar(b?toupper(a):a));
}
```
a is the input character; b is true if the last character was space. The only non-obvious bit is that we use the fact that `putchar` returns the character printed if there's no error.
[Answer]
# C# Linq - 187
This is nowhere close to winning but I just love Linq too much.
```
namespace System{using Linq;class P{static void Main(string[]a){Console.Write(a[0].Substring(1).Aggregate(a[0][0].ToString().ToUpper(),(b,c)=>b[b.Length-1]==32?b+char.ToUpper(c):b+c));}}}
```
[Answer]
# Java 8, 135 bytes
It's rare that I beat all the other answers that use the same language.
```
interface M{static void main(String[]a){int c=0;for(char i:a[0].toCharArray()){System.out.print(c==0?(i+"").toUpperCase():i);c=i-32;}}}
```
[TIO](https://tio.run/##HY9Bb4JAEIX/ysQTpIGY2l40pmlJerKX2p6MMcMywCjs0GFBV@Nvp9seX/K@L@8dccTkWJymia0jLdEQfNx6h44NjMIFtMg22jplW@32GN9CD8x6vipFI1OjAi9xN9@nTrKQXlXRR3F82/reUZvK4NIusC4y6/X8JeKH2SwO3e@uI82wpyhecrwya04Wj6v7/T5NE2XStqRhiYo59SkYxavPsKXmj4DeDWWZwsHVEhJ0XJHYxAkV0NdkLVqu0AbunUk9OEVu8gav4QEsnp7B1azOJ@4s8CkVaQpfNcHPwOYEucrZQikXOA5tF4wykgaCIAg8FFIFb9agNR7e/rtnGZoCahwJciILRqQB7GFDF9gMYWPwVyLFIff0Cw)
[Answer]
# Bash, 61
```
a="${@//: / }"
a=(${a//: / })
a="${a[@]^}"
echo "${a//:/ }"
```
Note the colons are simply to make the program display OK here. In reality these can be some non-printable character, such as BEL.
### Output
```
$ ./cap1st.sh "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"
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
$ 
```
---
# Bash, 12
Sadly this one doesn't preserve leading/mutliple/trailing spaces, but otherwise it works:
```
echo "${@^}"
```
### Output
```
$ ./cap1st.sh 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
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
$ 
```
[Answer]
# [Pip](http://github.com/dloscutoff/pip), 15 + 1 for `-s` = 16
```
{IaUC:a@0a}Ma^s
```
Explanation:
```
                  a is first cmdline arg (implicit)
            a^s   Split a on spaces
{         }M      Map this function to each element:
 Ia                 If the word is not empty,
   UC:a@0             uppercase its first character
         a          Return the word
                  Output the resulting list (implicit) joined on spaces (-s flag)
```
One interesting feature of Pip that this program draws on is the `:` assignment meta-operator. Most C-like languages have some set of compute-and-assign operators: e.g. `x*=5` does the same thing as `x=x*5`. In Pip, however, you can tack `:` onto *any* operator and turn it into a compute-and-assign operator. This even goes for unary operators. So `-:x` computes `-x` and assigns it back to `x`, the same as `x:-x` would. In this case, `UC:` is used (together with Pip's mutable strings) to uppercase the first character of a word.
The program takes input from the command-line, requiring an invocation like this:
```
python3 pip.py -se "{IaUC:a@0a}Ma^s" "test teSt TEST  _test"
```
[Answer]
# C, 125
Not the shortest of solutions, but I really like to golf in C.
```
char b[99];main(c){while(scanf("%[A-Za-z_-]",b)==1)islower(*b)&&(*b&=223),printf("%s",b);~(c=getchar())&&putchar(c)&&main();}
```
ungolfed:
```
char b[99];
main(c)
{
  while(scanf("%[A-Za-z_-]", b) == 1) {
    if(islower(b[0])) {
      b[0] &= 0xDF;
    }
    printf("%s", b);
  }
  if((c = getchar()) != -1) {
      putchar(c);
      main();
  }
}
```
I don't know wheter using regex-like syntax in `scanf` is streching the rules, but it works quite nicely. (Well, technically it's not a *full* regex)
An other thing to consider is that this code only works for words shorter than 99 bytes. But I think this solution will work for most cases.
[Answer]
**Haskell: 127 characters**
```
import Data.List
import Data.Char
i=isSpace
s a b=i a==i b
u (w:ws)=(toUpper w):ws
f w=concatMap u$groupBy s w
main=interact f
```
[Answer]
# PHP, 82
```
echo join(' ',array_map(function($s){return ucfirst($s);},explode(' ',$argv[1])));
```
Usage : 
```
$ php code.php "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"
```
[Answer]
## C#, ~~133~~ 131
```
using C=System.Console;class P{static void Main(){var s=2>1;foreach(var c in C.ReadLine()){C.Write(s?char.ToUpper(c):c);s=c==32;}}}
```
]