diff options
Diffstat (limited to 'other/detect_capital.cpp')
-rw-r--r-- | other/detect_capital.cpp | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/other/detect_capital.cpp b/other/detect_capital.cpp deleted file mode 100644 index 27aa46b..0000000 --- a/other/detect_capital.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - bool detectCapitalUse(string word) { - bool firstCaps = isupper(word[0]), allCaps = true, allLower = true; - for (int i = 1; i < word.size(); i++) { - if (isupper(word[i])) - allLower = false; - else - allCaps = false; - } - return (firstCaps && allCaps) || allLower; - } -}; - -int main() { - Solution obj; - testBool(obj.detectCapitalUse("USA")); // true - testBool(obj.detectCapitalUse("FlaG")); // false -} |