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 1786. Sandro's Biography

Не проходит шестой тест
Posted by Theodike 19 Dec 2018 01:28
Прошу помочь.
Написал алгоритм на питоне, все придуманные мной примеры работают, однако шестой тест неумолим...
Подскажите, где ошибка? Код прилагаю

string = input()
find = 'Sandro'
lst = []
string = '      ' + string + '      '
def counter(indexInFind, indexInString):
    global string
    global find
    summ = 0
    index = 0
    temp=''
    for i in range(indexInString - indexInFind, indexInString - indexInFind + 6):
        if string[i] == ' ':
            return #
        if string[i] != find[index]:
            summ += 5
        index += 1
        temp += string[i]
    return summ if temp.find('S') != -1 or temp.find('s') != -1 else summ+5
for i in range(len(string)):
    strfind = find.find(string[i])
    if strfind != -1:
        lst.append(counter(strfind, i))
print(min(lst) if len(lst) != 0 else 35)

Edited by author 19.12.2018 01:29

Edited by author 19.12.2018 01:29

Edited by author 19.12.2018 01:31