Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
396 B
3
Indexable
#include <bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    getline(cin, s);

    for(int i=0; i<s.length(); i++) {
        if(i == 0 || i == (s.length()-1)) {
            s[i] = toupper(s[i]);
        }
        else if(s[i] == ' ') {
            s[i-1] = toupper(s[i-1]);
            s[i+1] = toupper(s[i+1]);
        }
    }

    cout<<s<<endl;
return 0;
}