Skip to content

Hackerrank

Capitalize the first letter in each word

Note

title and capitalize functions are different. eg: '11a'.title() is 11A where is '11a'.capitalize is 11a.

def solve(s):
    for word in s.split():
        s = s.replace(word, word.capitalize())
    return s