easy

#include<iostream>
#include<string>
using namespace std;
int main()
{
    string str,temp;
    while (getline(cin, str)) {
        for (int i = 0,j,flag; i < str.size(); ) {
            for (j = i,flag = 0; (str[j] >= 'a' && str[j] <= 'z') ||
                (str[j] >= 'A' && str[j] <= 'Z') || (str[j] >= '0' && str[j] <= '9');++j) {
                flag = 1;
                if (j == i)
                    cout << char(toupper(str[j]));
                else
                    cout << str[j];
            }
            if (flag)
                i = j;
            else
                cout << str[i++];
        }
    }
}