Skip to content

Commit a820bda

Browse files
committed
Sync LeetCode submission - Detect Capital (c)
1 parent 1d3531c commit a820bda

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
bool detectCapitalUse(char* word) {
2+
int all_upper = 1;
3+
int all_lower = 1;
4+
int i = 1;
5+
while (*(word + i) != '\0') {
6+
isupper(*(word + i)) ? (all_lower = 0) : (all_upper = 0);
7+
if (all_lower == all_upper) { return 0; };
8+
++i;
9+
}
10+
return all_lower || (isupper(*word) && all_upper);
11+
}

0 commit comments

Comments
 (0)