1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
def f(a):
print('. '.join(x.strip().capitalize() for x in a.split('.') if x!='')+'.')
tests = [
'tHIS SenteNce HAS veRy bAd GrammAr.'# ==> This sentence has very bad grammar.
,'PuncTuation must-be PReserved.'# ==> Punctuation must-be preserved.
,'full StOps ShoulD Be inserted'# ==> Full stops should be inserted.
,'MultiPLe sEntEnceS Are possible. thEY Are, yoU KNOW.'# ==> Multiple sentences are possible. They are, you know.
,'MultiPle spaCes are REPLACEd. reallY'# ==> Multiple Spaces are replaced. Really.
,'spaces. are.inserted.'# ==> Spaces. Are. Inserted.
]
for t in tests:
f(t)
print('. '.join(x.strip().capitalize() for x in input().split('.') if x!='')+'.')