j33vansh

Answer 2 Strings CPP

Jul 1st, 2021
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4. int main()
  5. {
  6.     string str;
  7.     cout<<"Enter string\n";
  8.     cin>>str;
  9.     int count=1;
  10.     if(str[0]>='a'&&str[0]<='z')
  11.     {
  12.         for(int i=0;i<str.size();i++)
  13.         {
  14.             if(str[i]>='A'&&str[i]<='Z')
  15.             {
  16.                 count++;
  17.             }
  18.         }
  19.         cout<<count;
  20.     }
  21.     else cout<<"NO CAMEL CASE\n";
  22.    
  23.     return 0;
  24. }    
  25.        
Advertisement
Add Comment
Please, Sign In to add comment