hiho week 107 register

Ended

Participants:535

Verdict:Accepted
Score:100 / 100
Submitted:2016-07-17 12:21:09

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 <sstream>
using namespace std;
void toLitter(string &s){
    for(int i=0;i<s.size();i++)
        if(s[i]>='A' && s[i]<='Z')
            s[i]+=32;
}
int main(){
//  freopen("data.txt","r",stdin);
    string line,s;
    while(getline(cin,line)){
        bool first=true,first_sentence=true;
        stringstream ss(line);
        while(ss>>s){
            if(s==","){
                cout<<',';
            }else if(s=="."){
                cout<<'.';
                first_sentence=true;
            }else{
                toLitter(s);
                if(first){
                    first=false;
                }else{
                    cout<<' ';
                }
                if(first_sentence){
                    s[0]-=32;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX