hiho week 107 register

Ended

Participants:535

Verdict:Accepted
Score:100 / 100
Submitted:2016-07-16 21:05:33

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>
int main()
{
    int blank = 0, end = 1;
    int pos;
    char c;
    while(~scanf("%c", &c)){
        if (c == '.'){
            putchar(c);
            end = 1;
        }else if (c == ' '){
            blank = 1;
        }else if (c == '\n'){
            putchar('\n');
            end = 1;
            blank = 0;
        }else if (c == ','){
            putchar(',');
        }else {
            if (end){
                if (c > 'Z'){
                    c -= 32;
                }
            }else{
                if (c < 'a'){
                    c += 32;
                }
            }
            if (blank){
                putchar(' ');
            }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX