Detect Capital Problem

Detect Capital Problem — ExecCode School DSA Practice

Solve the Detect Capital problem on ExecCode. Free online school DSA practice in String. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given a word, determine if its capitalization is correct. Your task is to solve Detect Capital. A word's capitalization is correct if all letters are capitals, all letters are not capitals, or only the first letter is a capital.

Examples

Input USA; Output True. Input leetcode; Output True

Constraints

1 <= n <= 10^5

Practice Detect Capital free on ExecCode. Browse DSA problems, topic map, and placement guides.