C++ 1-liner


  • 3
    J

    May be duplicate with other posts.

    class Solution {
    public:
        bool detectCapitalUse(string word) {
            return regex_match(word, regex("[A-Z]+|[a-z]+|[A-Z][a-z]*"));
        }
    };
    

Log in to reply
 

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