Java Solution


  • 0
    
        public boolean detectCapitalUse(String word) {
            String s =   word.substring(0,1).toUpperCase() + word.substring(1).toLowerCase();
            if(word.equals(word.toUpperCase())||word.equals(word.toLowerCase())||word.equals(s)){
                return true;
            }
            return false;
            
        }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.