camel case
Sun Sep 22 2024 09:50:21 GMT+0000 (Coordinated Universal Time)
Saved by
@CodeXboss
#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;
}
content_copyCOPY
Comments