fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n;
  6. string s;
  7. cin>>s;
  8. n=s.length();
  9. string pr="";
  10. for(int i=0;i<n;i++)
  11. {
  12. pr.push_back(s[i]);
  13. if(i==n-1) //last letter
  14. cout<<pr<<endl;
  15. else if(s[i+1]>='A' && s[i+1]<='Z') //s[i+1] is a capital letter.
  16. {
  17. cout<<pr<<endl;
  18. pr="";
  19. }
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 4168KB
stdin
IHopeYouUnderstandThisNow
stdout
I
Hope
You
Understand
This
Now