fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. string s;
  7. getline(cin,s);
  8. s[0] = toupper(s[0]);
  9. int n = s.size();
  10. for (int i = 1; i < n; i++)
  11. if (s[i-1] == ' ' and s[i] != ' ')
  12. s[i] = toupper(s[i]);
  13. else s[i] = tolower(s[i]);
  14. cout << s;
  15. return 0;
  16. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty