Python
# Program to capitalize first letter of each word
s = input("Enter a sentence: ")
result = s.title()
print("Title case:", result)Output
Enter a sentence: hello world Title case: Hello World
We use .title() which capitalizes the first character of each word and lowercases the rest.