Can u read this

mam i am not getting how to solve this question that where to end the loop
can u give some hint

iterate on string
for(int i=0;str[i]!='\0';i++)
and check if the current character str[i] is a capital letter or not
if(str[i]>='A'&&str[i]<='Z') cout<<endl;

Reference Code