TopCoder problem "TitleString" used in SRM 210 (Division II Level One)



Problem Statement

    A common word-processing task is capitalizing the first letter of each word in a title. Write a class TitleString with a method toFirstUpperCase that takes a String title containing lowercase words separated by one or more space characters and returns a String that is identical to title except with the first character of each word capitalized.
 

Definition

    
Class:TitleString
Method:toFirstUpperCase
Parameters:String
Returns:String
Method signature:String toFirstUpperCase(String title)
(be sure your method is public)
    
 

Notes

-title may have leading or trailing spaces.
 

Constraints

-title will contain between 0 and 50 characters, inclusive.
-Each character of title will either be a space or a lowercase letter ('a' to 'z').
 

Examples

0)
    
"introduction to algorithms"
Returns: "Introduction To Algorithms"
1)
    
"more than  one   space    between     words"
Returns: "More Than  One   Space    Between     Words"
2)
    
"  lord of the rings   the fellowship of the ring  "
Returns: "  Lord Of The Rings   The Fellowship Of The Ring  "
3)
    
"  "
Returns: "  "
4)
    
"i"
Returns: "I"
5)
    
"the king and i"
Returns: "The King And I"
6)
    
""
Returns: ""

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=2988

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=5856&pm=2988

Writer:

the_one_smiley

Testers:

PabloGilberto , lbackstrom , brett1479

Problem categories:

String Manipulation, String Parsing