File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ class Solution {
2+ public:
3+ bool detectCapitalUse (string word) {
4+ int n=word.length ();
5+ if ((word[0 ]-NULL >=65 && word[0 ]-NULL <=90 ) && (word[1 ]-NULL >=65 && word[1 ]-NULL <=90 )){
6+ for (int i=2 ;i<n;i++){
7+ if (word[i]-' z' <=26 && word[i]-' a' >=0 ){
8+ cout<<" yryr" <<endl;
9+ return 0 ;
10+ }
11+ }
12+ }
13+ else if (word[0 ]-NULL <=122 && word[0 ]-NULL >=97 ){
14+ for (int i=1 ;i<n;i++){
15+ if (word[i]-NULL <=90 && word[i]-NULL >=65 ){
16+ cout<<" yryr" <<endl;
17+ return 0 ;
18+ }
19+ }
20+ return 1 ;
21+ }
22+ else if ((word[0 ]-NULL <=122 && word[0 ]-NULL >=97 ) && ( word[1 ]-NULL <=122 && word[1 ]-NULL >=97 ) ){
23+ for (int i=2 ;i<n;i++){
24+ if (word[i]-NULL <=90 && word[i]-NULL >=65 ){
25+ cout<<" yryr" <<endl;
26+ return 0 ;
27+ }
28+ }
29+ }
30+ else if ((word[0 ]-NULL >=65 && word[0 ]-NULL <=90 ) && (word[1 ]-NULL <=122 && word[1 ]-NULL >=97 )){
31+ for (int i=2 ;i<n;i++){
32+ if (word[i]-NULL <=90 && word[i]-NULL >=65 ){
33+ cout<<" yryr" <<endl;
34+ return 0 ;
35+ }
36+ }
37+ }
38+ return 1 ;
39+ }
40+
41+ };
You can’t perform that action at this time.
0 commit comments