# 520. Detect Capital import sys class Solution: def detectCapitalUse(self, word: str) -> bool: if word[0].islower(): return all(x.islower() for x in word[1:]) return all(x.islower() for x in word[1:]) or all(x.isupper() for x in word[1:]) pass def main() -> int: def r(word: str, exp: bool) -> None: ret: bool = Solution().detectCapitalUse(word) print( f"Solution().detectCapitalUse({word}) = {ret} | exp: {exp}" ) pass r("USA", True) r("FlaG", False) return 0 if __name__ == "__main__": sys.exit(main())