All problems

Problem 523

Detect Capital

Easy · 10 pts · String

Problem

A word uses capital letters correctly in exactly three cases: every letter is uppercase (like USA), every letter is lowercase (like leetcode), or only the first letter is uppercase (like Google). Given a word made of English letters, decide whether it uses capitals correctly. A single letter is always correct, whichever case it is. Print YES or NO.

Input

A single word W made of English letters.

Output

Print YES if the capitals are used correctly, otherwise NO.

Constraints

1 <= |W| <= 100

Example input

USA

Example output

YES

Explanation

In USA every letter is uppercase, which is allowed, so the answer is YES. A word like FlaG mixes cases after the first letter, so it would be NO.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: Maximum Number of Balloons Next: Valid Word Abbreviation