Submission details
Task:Palindrome
Sender:dani28
Submission time:2016-10-22 15:00:31 +0300
Language:Python3
Status:READY
Result:
Test results
testverdicttime
#10.07 sdetails
#20.07 sdetails
#30.07 sdetails
#40.09 sdetails
#50.07 sdetails
#60.07 sdetails
#70.08 sdetails

Code

import sys
def longestPalSubstr(string):
    maxLength = 1
 
    start = 0
    length = len(string)
 
    low = 0
    high = 0
    for i in xrange(1, length):
        low = i - 1
        high = i
        while low >= 0 and high < length and string[low] == string[high]:
            if high - low + 1 > maxLength:
                start = low
                maxLength = high - low + 1
            low -= 1
            high += 1
        low = i - 1
        high = i + 1
        while low >= 0 and high < length and string[low] == string[high]:
            if high - low + 1 > maxLength:
                start = low
                maxLength = high - low + 1
            low -= 1
            high += 1
 
    print string[start:start + maxLength]
 
    return maxLength
string = sys.stdin.readline()
longestPalSubstr(string)

Test details

Test 1

Verdict:

input
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

correct output
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

user output
(empty)

Error:
File "input/code.py", line 28
    print string[start:start + maxLength]
               ^
SyntaxError: Missing parentheses in call to 'print'

Test 2

Verdict:

input
saippuakauppiassaippuakauppias...

correct output
saippuakauppiassaippuakauppias...

user output
(empty)

Error:
File "input/code.py", line 28
    print string[start:start + maxLength]
               ^
SyntaxError: Missing parentheses in call to 'print'

Test 3

Verdict:

input
yfsnqpzfxfhdnbozewnjtseeyktblk...

correct output
buevzveub

user output
(empty)

Error:
File "input/code.py", line 28
    print string[start:start + maxLength]
               ^
SyntaxError: Missing parentheses in call to 'print'

Test 4

Verdict:

input
oyyahdsjdwtziuwnmpjhshemvxodtc...

correct output
rrfaxafuttsospqnxbwaufpchwjaha...

user output
(empty)

Error:
File "input/code.py", line 28
    print string[start:start + maxLength]
               ^
SyntaxError: Missing parentheses in call to 'print'

Test 5

Verdict:

input
tcaxtmkrvjovwnhsqquwxuemckkmks...

correct output
xtmkrvjovwnhsqquwxuemckkmksqqj...

user output
(empty)

Error:
File "input/code.py", line 28
    print string[start:start + maxLength]
               ^
SyntaxError: Missing parentheses in call to 'print'

Test 6

Verdict:

input
mwuepokhcaykorctrxqvplhxbxjndd...

correct output
eyexbstwynwjbqjasyuaqrmckrgmki...

user output
(empty)

Error:
File "input/code.py", line 28
    print string[start:start + maxLength]
               ^
SyntaxError: Missing parentheses in call to 'print'

Test 7

Verdict:

input
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

correct output
bcbcbcbcbcbcbcbcbcbcbcbcbcbcbc...

user output
(empty)

Error:
File "input/code.py", line 28
    print string[start:start + maxLength]
               ^
SyntaxError: Missing parentheses in call to 'print'