Getting Wrong output in camel case problem (CanYouReadThis? in Strings challenge)

#include
#include

using namespace std;

//Camelcase
int main() {
string s;
getline(cin,s);
int len = s.length();
int i=0,j=0;

while (s[i] != '\0'){
    if (isupper(s[i])){
        for (j=i+1; s[j] != '\0';j++){
            if (isupper(s[j])){
                cout<<s.substr(i,j)<<endl;
                break;
            }
            
        }
        i=j;
                   
    }
    //i+=1;
}
return 0;

}