ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1038. Spell Checker

AC
Posted by Alexandr Vasilyev 6 Jul 2016 16:44
My program (with error, I know where it is, but I will not write about it):
import sys
text = sys.stdin.readlines()
text = ''.join(text)
for symbol in ',;:-\n':
    text = text.replace(symbol, ' ')
text = text.replace('!', '.').replace('?', '.')
import re
text = ' '.join(text.split())
text = text.replace('. ', '.')
text = '.'.join(text.split('.'))
text = text.replace(' .', '.')
count = 0
for sentence in text.split('.'):
    if sentence != '':
        if sentence[0].islower():
            count += 1
        for word in sentence.split():
            for letter in word[1:]:
                if letter.isupper():
                    count += 1
print(count)

Edited by author 06.07.2016 19:17