String Challenge: Camel Case Problem,

I used a simplified solution to this problem which focuses of printing the solution (as required ) instead of extracting the words. i have run multple tests which seem to be working fine with my code, but i am unable to pass any of the testcases .
i have accounted for the terminating null chars and newlines in my implementation but nothing seems to be working :
Please go through my code for your reference:
#include
#include
#include<ctype.h>
using namespace std;
int main() {
string s;
cin>>s;
for (int i=0;i<s.length()+1;i++){
if(islower(s[i])==1){
cout<<s[i];
}
else if(i==0){
cout<<s[i];
}
else{
cout<<’\0’<<endl<<s[i];
}
}
cout<<’\0’;
return 0;
}

//Thanks for your guidance :slight_smile:

@ilovetocode your latest submission shows 100 points
so if your doubt is cleared just mark it resolved

Hi Vatsal,

I just pasted a code I found online with a slightly different approach, (to see if there was any problem with the website itself) …I’m still unable to figure out why my actual code isn’t working.

I am new to c++ and programming and found your course extremely helpful. Please see if you can resolve my doubt at your earliest convenience.

Thanks you

Regards

Kritika

@ilovetocode corrected your code ( no +1 required and removed null characters , dont print them they are garbage)


dont forget to hit like and mark resolved if cleared :smiley:

1 Like

Thanks for your help!