aboutsummaryrefslogtreecommitdiff
path: root/detect_capital.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'detect_capital.cpp')
-rw-r--r--detect_capital.cpp21
1 files changed, 0 insertions, 21 deletions
diff --git a/detect_capital.cpp b/detect_capital.cpp
deleted file mode 100644
index 27aa46b..0000000
--- a/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
-}