#include <iostream>
#include <string>
#include <cctype>
using namespace std;

int main() {
    string s,a;
    getline(cin,s);
    bool starttopush=true;
    for(auto c : s){
        if(starttopush){
            a+=toupper(c);
            starttopush=false;
        }
        if (c==' ') {
            starttopush=true;
        }
    }
    cout<<a;
}

一个直观的解法。