Recognize the Three Valid Capitalization Patterns
Company: Google
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Other
### Problem
Return whether word uses one of three patterns: all uppercase letters, all lowercase letters, or only its first letter uppercase. Input contains English letters only.
```cpp
class Solution {
public:
bool detectCapitalUse(string word);
};
```
### Examples
**Example 1:**
```text
word = "River"
Output: true
Explanation: Only the first character is uppercase.
```
**Example 2:**
```text
word = "riVer"
Output: false
Explanation: A later uppercase character violates all three patterns.
```
### Constraints
- The word contains 1..100 characters; each is an English uppercase or lowercase letter.
### Clarifying Questions
Check the position of a lone uppercase letter as well as its count.
```hint Read the boundary condition
Can the three permitted patterns be expressed using one uppercase count?
```
### Contract considerations
Check the position of a lone uppercase letter as well as its count.