 All Problems
Detect Capital
easy
strings
facebook
amazon

We define the usage of capitals in a word to be right when one of the following cases holds:

  • All letters are capitals (e.g. "USA")
  • All letters are not capitals (e.g. "leetcode")
  • Only the first letter is capital (e.g. "Google")

Given a string word, return true if the usage is right, false otherwise.

Example 1:

Input: USA
Output: true

Example 2:

Input: FlaG
Output: false

Input format: A single word.

Output format: true or false.

Run to check your code against the sample cases, or submit to run every case