Count of camel case characters present in a given string | C ++ program for the above approach ; Function to count all the camelcase characters in the string S ; Stores the total count of camelcase characters ; Traverse the string S ; If ASCII value of character lies over the range [ 65 , 91 ] then increment the count ; Print the total count obtained ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int countCamelCase ( string & S ) { int count = 0 ; for ( int i = 0 ; S [ i ] ; i ++ ) { if ( S [ i ] >= 65 && S [ i ] <= 91 ) { count ++ ; } } cout << count ; } int main ( ) { string S = " ckjkUUYII " ; countCamelCase ( S ) ; return 0 ; }