How to Convert All Word’s First Letter into Big Letter and Remaining in Small Letter if whole words are in Uppercase?

I am trying to change the first Letter of Each Word into Big Letter and Remaining Small in the following case if whole words are in Big Letters.

Example: THIS IS A CAT:

Output Require: This Is A Cat.

<style>    
/*not working if all words are in UPPERCASE.*/
text-transform: capitalize; 
</style>

/*PHP not working*/
<?PHP ucword(); ?>