Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.021 s | 3 KBi |
#2 |
Correcto
|
0.02 s | 3 KBi |
#3 |
Correcto
|
0.023 s | 3 KBi |
#4 |
Correcto
|
0.029 s | 3 KBi |
#5 |
Correcto
|
0.019 s | 3 KBi |
#6 |
Correcto
|
0.024 s | 3 KBi |
#7 |
Correcto
|
0.061 s | 7 KBi |
#8 |
Correcto
|
0.062 s | 7 KBi |
#9 |
Correcto
|
0.061 s | 7 KBi |
#10 |
Correcto
|
0.058 s | 7 KBi |
#11 |
Correcto
|
0.078 s | 7 KBi |
#12 |
Correcto
|
0.06 s | 7 KBi |
#13 |
Correcto
|
0.081 s | 7 KBi |
#14 |
Correcto
|
0.106 s | 7 KBi |
#15 |
Correcto
|
0.077 s | 7 KBi |
#16 |
Correcto
|
0.127 s | 7 KBi |
#17 |
Correcto
|
0.064 s | 5 KBi |
#18 |
Correcto
|
0.055 s | 4 KBi |
#19 |
Correcto
|
0.084 s | 4 KBi |
#20 |
Correcto
|
0.075 s | 4 KBi |
#21 |
Correcto
|
0.051 s | 4 KBi |
#22 |
Correcto
|
0.054 s | 4 KBi |
def prefix(s): i = 1 j = cur = 0 p = [0] * len(s) while i < len(s): if s[i] == s[j]: p[i] = j + 1 i += 1 j += 1 elif j != 0: j = p[j - 1] else: i += 1 return p if __name__ == "__main__": s = input() print(prefix(s)[-1])