hiho week 107 register

Ended

Participants:535

Verdict:Accepted
Score:100 / 100
Submitted:2016-07-23 18:21:19

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string s;
    while (getline(cin, s)) {
        string ori, word;
        bool sentBegin = true;
        for (auto i : s) {
            if (i >= 'A' && i <= 'Z') {
                i = i - 'A' + 'a';
            }
            if (i >= 'a' && i <= 'z') {
                if (sentBegin && word.empty()) {
                    i = i - 'a' + 'A';
                }
                word += i;
            }
            else {
                if (!word.empty()) {
                    if (sentBegin) {
                        if (!ori.empty()) {
                            ori += ' ';
                        }
                        ori += word;
                        sentBegin = false;
                    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX