#include <iostream> #include <string> using namespace std; int camelcase(const string& s) { int wordCount = 1; // Start with 1 to account for the first word for (char ch : s) { if (isupper(ch)) { wordCount++; // Increment the count for every uppercase letter } } return wordCount; } int main() { string s; cin >> s; // Input the CamelCase string cout << camelcase(s) << endl; // Output the number of words return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter