We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f412550 commit 0424b7aCopy full SHA for 0424b7a
leetcode/cpp/string/520.cpp
@@ -0,0 +1,47 @@
1
+class Solution {
2
+public:
3
+ bool detectCapitalUse(string word) {
4
+ bool upper=true,lower=true;
5
+ if(word[0]-'A'>=0&&word[0]-'A'<26)
6
+ {
7
+ for(int i=1;i<word.size();i++)
8
9
+ if(word[i]-'a'>=0&&word[i]-'a'<26)
10
11
+ continue;
12
+ }
13
+ else{
14
+ lower=false;
15
+ break;
16
17
18
19
20
+ if(word[i]-'A'>=0&&word[i]-'A'<26)
21
22
23
24
25
+ upper=false;
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
+ bool ans=upper|lower;
45
+ return ans;
46
47
+};
0 commit comments