LeetCode --- 2129. Capitalize the Title 解题报告

Question:

You are given a string title consisting of one or more words separated by a single space, where each word consists of English letters. Capitalize the string by changing the capitalization of each word such that:

  • If the length of the word is 1 or 2 letters, change all letters to lowercase.
  • Otherwise, change the first letter to uppercase and the remaining letters to lowercase.

Return the capitalized title.

Example 1:

Input: title = "capiTalIze tHe titLe"
Output: "Capitalize The Title"
Explanation:
Since all the words have a length of at least 3, the first letter of each word is uppercase, and the remaining letters are lowercase.

Example 2:

Input: title = "First l

相关推荐

  1. LeetCode --- 2129. Capitalize the Title 解题报告

    2024-07-17 09:10:01       20 阅读
  2. LeetCode --- 2119. A Number After a Double Reversal 解题报告

    2024-07-17 09:10:01       20 阅读
  3. LeetCode解法汇总2129. 将标题首字母大写

    2024-07-17 09:10:01       36 阅读
  4. LeetCode --- 2103. Rings and Rods 解题报告

    2024-07-17 09:10:01       17 阅读
  5. LeetCode 981, 219, 78

    2024-07-17 09:10:01       27 阅读
  6. Leetcode. 212 单词搜索II

    2024-07-17 09:10:01       55 阅读
  7. LeetCode 212.单词搜索II

    2024-07-17 09:10:01       29 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-17 09:10:01       70 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-17 09:10:01       74 阅读
  3. 在Django里面运行非项目文件

    2024-07-17 09:10:01       62 阅读
  4. Python语言-面向对象

    2024-07-17 09:10:01       72 阅读

热门阅读

  1. 达梦数据库-学习

    2024-07-17 09:10:01       26 阅读
  2. golang系统文件路径与文件打开问题

    2024-07-17 09:10:01       23 阅读
  3. 【问题记录】线程池死锁问题

    2024-07-17 09:10:01       24 阅读
  4. 【工具类】对象比较工具类实现

    2024-07-17 09:10:01       21 阅读
  5. Python3 第二十四课 -- 模块

    2024-07-17 09:10:01       20 阅读
  6. 你不需要 CSS 框架

    2024-07-17 09:10:01       24 阅读
  7. 使用 RocketMQ 实现消息的顺序消费

    2024-07-17 09:10:01       26 阅读
  8. c#之修饰符知识点

    2024-07-17 09:10:01       25 阅读
  9. Conda的冲突解决艺术:在包依赖中寻找和谐

    2024-07-17 09:10:01       27 阅读