[LeetCode] 2129. Capitalize the Title
Python
class Solution:
def capitalizeTitle(self, title: str) -> str:
answer = []
title = title.lower()
temp = title.split()
for i in temp:
if len(i) > 2:
i = i.capitalize()
answer.append(i)
return " ".join(answer)
댓글남기기