Number of words in a camelcase sequence | CPP code to find the count of words in a CamelCase sequence ; Function to find the count of words in a CamelCase sequence ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int countWords ( string str ) { int count = 1 ; for ( int i = 1 ; i < str . length ( ) - 1 ; i ++ ) { if ( isupper ( str [ i ] ) ) count ++ ; } return count ; } int main ( ) { string str = " geeksForGeeks " ; cout << countWords ( str ) ; return 0 ; }