hiho week 107 register

Ended

Participants:535

Verdict:Accepted
Score:100 / 100
Submitted:2016-07-23 19:32:17

Lang:Python2

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
while True:
    try:
        start = True
        line = raw_input()
        ans = ''
        for ch in line:
            if ch == '.' or ch == ',':
                if ch == '.':
                    start = True
                if ans[-1] == ' ':
                    ans = ans[:-1]
                ans += ch
            elif ch == ' ':
                if ans[-1] != ' ':
                    ans += ' '
            else:
                if start:
                    ans += ch.upper()
                    start = False
                else:
                    ans += ch.lower()
        print ans
    except EOFError:
        break
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX