2129. Capitalize the Title

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 2129

class Solution:
    def capitalizeTitle(self, title: str) -> str:
        words = [w.lower() if len(w) < 3 else w.capitalize() for w in title.split()]
        return " ".join(words)