fork download
  1. #include<iostream>
  2. #include<string>
  3. #include<cctype>
  4.  
  5. int main()
  6. {
  7. std::string str;
  8. getline(std::cin,str);
  9. for(int j=0;j<str.length();j++)
  10. {
  11. str[j]=tolower(str[j]);
  12. }
  13. for(int i=0;i<str.length();)
  14. {
  15. if(i==0)
  16. {
  17. str[i]=toupper(str[i]);
  18. i++;}
  19. else if(str[i]==' ')
  20. {
  21. i++;
  22. str[i]=toupper(str[i]);
  23. }
  24. else
  25. {i++;}
  26.  
  27. }
  28. std::cout<<str;
  29. }
Success #stdin #stdout 0s 3464KB
stdin
zoHO coRporation 1st recruitment
stdout
Zoho Corporation 1st Recruitment