CanYouReadThis?

can u help me understand and solve the below q (cpp soln must)

One of the important aspect of object oriented programming is readability of the code. To enhance the readability of code, developers write function and variable names in Camel Case. You are given a string, S, written in Camel Case. FindAllTheWordsContainedInIt.
Input Format

A single line contains the string.
Constraints

|S|<=1000
Output Format

Print words present in the string, in the order in which it appears in the string.
Sample Input

IAmACompetitiveProgrammer

Sample Output

I
Am
A
Competitive
Programmer

Explanation

There are 5 words in the string.

hello @Kash-Moulik-3715574511847721

we are following camecase so whenver we encounter any capital letter then that will signify that last words ended and new word started.
for example-> abcDeeG

here-> abc will be one word becuase next element (D) is in capital letter .
then Dee (again becuase G is in capital)
and G.

logic->

iterate the string from 0 to last index.
    step 1) if current character belongs to { 'A'....'Z } then print newline character
   
    step 2) print current character

cpp soln will also be good’

@Kash-Moulik-3715574511847721
check this->

 #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
for(int i=0;i<s.size();i++){
	if(s[i]>='A' && s[i]<='Z')
	   cout<<"\n";

	   cout<<s[i];
}


}