520. Detect Capital
来源:互联网 发布:wifi防蹭网软件 编辑:程序博客网 时间:2024/06/06 03:34
Given a word, you need to judge whether the usage of capitals in it is right or not.
We define the usage of capitals in a word to be right when one of the following cases holds:
All letters in this word are capitals, like “USA”.
All letters in this word are not capitals, like “leetcode”.
Only the first letter in this word is capital if it has more than one letter, like “Google”.
Otherwise, we define that this word doesn’t use capitals in a right way.
Example 1:
Input: “USA”
Output: True
Example 2:
Input: “FlaG”
Output: False
Note: The input will be a non-empty word consisting of uppercase and lowercase latin letters.
class Solution(object): def detectCapitalUse(self, word): """ :type word: str :rtype: bool """ return word.lower() == word or word.upper() == word or word.capitalize() == word
阅读全文
0 0
- 【Leetcode】520. Detect Capital
- 520. Detect Capital (E)
- LeetCode 520. Detect Capital
- LeetCode 520. Detect Capital
- 520. Detect Capital
- LeetCode-520. Detect Capital
- 520. Detect Capital
- leetcode 520. Detect Capital
- 520. Detect Capital
- 520. Detect Capital
- 520. Detect Capital
- 520. Detect Capital
- leetcode 520. Detect Capital
- [leetcode] 520. Detect Capital
- 520. Detect Capital Easy
- 520. Detect Capital
- [LeetCode]520. Detect Capital
- 520. Detect Capital
- pyhton基础教程(学习笔记)
- Android Studio如果添加的是aar,要在gradle中,后面加上@aar
- canvas圆环百分比进度
- Adapter.notifyDataSetChanged()无效
- VBA字符串处理大全-from EH
- 520. Detect Capital
- AJAX使用回调函数
- MYSQL 优化常用方法
- c语言编程--c实现链表翻转
- vue项目启动之后出现cannot GET /
- Tomcat 优化方案 和 配置详解
- asp.net开发-记录-委托不执行(EventHandler事件无反应)
- FFMPEG学习【libavdevice】(一)
- mysql中or和in的效率问题