The solution is not getting accepted but I tired all the test cases they're running fine

My code is not getting acceoted but I tried all the test cases they’re working just fine.
#include
#include
#include

using namespace std;

int main() {

string s;

getline(cin, s);
int end2 = 0;
int i = 0;

while (i <= s.length()) {

	if (isupper(s[i])) {

		while (islower(s[i + 1])) {
			cout << s[i];
			i = i + 1;
		}
	}
	cout << s[i];
	if (i < s.length() - 1) {
		cout << endl;
	}

	i = i + 1;
}

}

Hey @tardev00 in your submission it’s showing me 100% marks , that means you have solved this problem.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.