By the way, the problem as stated is fairly simple (as others have demonstrated). However, there are a LOT of patterns which probably shouldn't be capitalized at all, or should have multiple capital letters in a word.
"Bit o' Mint"
"Mano y Mano"
"Chris diBona"
"Scrooge McDuck"
"Cruella de Ville"
"Jake O'Shaunessy"
"Tales from the Crypt"
"Sanford and Son Salvage Company"
Many of these cases are handled by what I call "title case." The rules vary from style guide to style guide, but as I learned them,
- The first word is capitalized, always.
- The last word is capitalized, always.
- Each remaining word is capitalized, except
- prepositions (of, by, from, ...),
- coordinating conjunctions (and, or),
- articles (the, a, an),
- common foreign prepositions, conjunctions, articles.
From there, you can try to "restore" words that fit certain patterns, but you'll probably fail. For example, "MacIntyre" but "Macintosh™." Names do not follow common grammatical or spelling rules; they are individual and a special case. Where possible, take the name's owner's spelling and don't corrupt it into all-caps in the first place.
--
[ e d @ h a l l e y . c c ]