Problem:


Score : 200 points

Problem Statement

We will call a string that can be obtained by concatenating two equal strings an even string.
For example, xyzxyz and aaaaaa are even, while ababab and xyzxy are not.

You are given an even string S consisting of lowercase English letters.
Find the length of the longest even string that can be obtained by deleting one or more characters from the end of S.
It is guaranteed that such a non-empty string exists for a given input.

Constraints

2 \leq |S| \leq 200

S is an even string consisting of lowercase English letters.

There exists a non-empty even string that can be obtained by deleting one or more characters from the end of S.

Input

Input is given from Standard Input in the following format:

S

Output

Print the length of the longest even string that can be obtained.

Sample Input 1

abaababaab

Sample Output 1

6

abaababaab itself is even, but we need to delete at least one character.

abaababaa is not even.

abaababa is not even.

abaabab is not even.

abaaba is even. Thus, we should print its length, 6.

Sample Input 2

xxxx

Sample Output 2

2

xxx is not even.

xx is even.

Sample Input 3

abcabcabcabc

Sample Output 3

6

The longest even string that can be obtained is abcabc, whose length is 6.

Sample Input 4

akasakaakasakasakaakas

Sample Output 4

14

The longest even string that can be obtained is akasakaakasaka, whose length is 14.



Sample input:
abaababaab


Sample output:
6

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;

int main(){
    string s; cin >> s;
    string tmp="", left="", right="";
    int ans = 0;
    int n = s.length();
    for(int i=1; i<n; i++){
        tmp = s.substr(0, n-i);
        if(tmp.length()%2 != 0){
            continue;
        }else{
            int t_len = tmp.length();
            left = tmp.substr(0, t_len/2);
            right = tmp.substr(t_len/2, t_len/2);
            if(left == right){
                ans = t_len;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
    
}

Submission status: Runtime Error

Solution code:
s=input()
n=len(s)//2

for x in range(1,n):
  if s[:n-i]==s[n-i:2*n-2*i]:
    print(2*n-2*i)
    break

Submission status: Runtime Error

Solution code:
s=list(input())
from copy import copy
t=s.copy()

for i in range(len(t)):
  if len(s)%2==0 and s[:len(s)/2]==s[len(s)/2:]:
    print(len(s))
    exit()
  else:
    s.pop(-1)

Submission status: Runtime Error

Solution code:
s=int(input())
print(len(s)/2)

Submission status: Runtime Error

Solution code:
s=input()
s=s.replace(s[-1],'')
while True:
    s=s.replace(s[-1],'')
    if len(s)%2==0 and s[:len(s)//2]==s[len(s)//2:]:
      print(len(s))
      break

Submission status: Runtime Error

Solution code:
s = input()[:-1]

length = len(s)

for a in range(length, 1, -1):
  temp = s[:a]
  if len(temp) %2 == 0:
    half = len(temp)//2
    if temp[:half] == temp[half:]:
      ans = len(temp)
    break #ここでbreakするために，forを"大きいところ"から回してる
    
print(ans)

Submission status: Runtime Error

Solution code:
s=list(input())
n=len(s)
s1=s[:n//2]
s2=s[n//2:]
for i in range(n//2):
  s2=s1[-1]+s2[:-2]
  s1=s1[:-1]
  if s2==s1:
    break
print(len(s1+s2))

Submission status: Runtime Error

Solution code:
s=list(input())
n=len(s)
s1=s[:n//2]
s2=s[n//2:]
for i in range(n//2):
  s2=s1[-1]+s2[:-2]
  s1=s1[:-1]
  if s2==s1:
    break
print(len(s1+s2)

Submission status: Runtime Error

Solution code:
s=int(input())
n=len(s)//2
while n!=0:
  
  if s[:n]==s[n:2*n]:
    print(n)
    break
  n=-1

Submission status: Runtime Error

Solution code:
S = list(input())[::-1]
s = len(S)
ans = 0
for i in range(s):
  if S[2*i:(2*i+s)/2+0.5] == S[(2*i+s)/2+0.5:]:
    ans = s-2*i
    break
print(ans)

Submission status: Runtime Error

Solution code:
s=input()
for i in range(len(s)/2-1,0,-1):
  if s[0:i]==s[i:i+i]:
    print(i)
    exit(0)

Submission status: Runtime Error

Solution code:
s=str(input())
s=list(s)
while True:
  del s[len(s)-1]
  if len(s)%2==0:
    count=0
    for i in range(0,int(len(s)/2)):
      if s[i]==s[i+int(len(s)/2)]:
        count=count+1
    if count==int(len(s)/2):
      print(len(s))

Submission status: Runtime Error

Solution code:
s = input()
for i in range(len(s)):
  s.pop(-1)
  if len(s) % 2 == 0:
    if s[:len(s)//2] == s[len(s)//2:]:
      print(len(s))
      break

Submission status: Runtime Error

Solution code:
python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    s= str(input())
    ls=len(s)
    cur=ls//2
    i=0
    while True:
        i+=1
        cur-=1
        if s[:cur]==s[cur:ls-i*2]:
            print(ls-i*2)
            break


    
resolve()

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string s;
  cin >> s;

  int n = s.length();
  int ans = 0;
  for (int i = 1; i * 2 < n; i++) {
    bool good = true;
    for (int j = 0; j < i; j++) {
      if (s[j] != s[j+i]) {
        good = false;
        break;
      }
    }
    if (good) ans = i * 2;
  }

  cout << ans << endl;

  return 0;
}

Submission status: Runtime Error

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
S = input()

for i in range(1, len(S)):
	T = S[:-2*i]
	if T[:len(T)//2] == T[len(T//2:)]:
		print(len(T))
		break

Submission status: Runtime Error

Solution code:
s = list(str(input()))

s_rev = list(reversed(s))
n = len(s_rev)

for i in range(len(s_rev)):
  del s_rev[0]
    if len(s_rev) % 2 == 1:
      continue
    elif s[0:len(s_rev) // 2] != s[len(s_rev) // 2:len(s_rev)]:
      continue  
    elif len(s_rev) != 0:
      print(len(s_rev))

Submission status: Runtime Error

Solution code:
S=str(input())
for i in range(len(S)):
  s = S[0:len(S)-i]
  if len(s)%2 == 0:
    if s[0:len(s)/2] == s[len(s)/2:len(s)]:
      break
print(len(s))

Submission status: Runtime Error

Solution code:
S = input
while len(S)!=0:
    S.pop()
    if len(S)%2==0 and S[0:len(S)/2]==S[len(S)/2:]:
        print(len(S))
        exit()

Submission status: Runtime Error

Solution code:
S = input().sprit()
n = len(S)

for i in range(n-2, 0, -2):
  S = S[:i]
  k = i // 2
  if S[k:] == S[:k]:
    print(i)
    exit()

Submission status: Runtime Error

Solution code:
s=input()
n=len(s)
print(max([n-i for i in range(0,n//2,2) if  s[:(n-i)//2]==s[(n-i)//2:-i]]))

Submission status: Runtime Error

Solution code:
s=input()
n=len(s)
prnt(max([n-i for i in range(0,n//2,2) if  s[:(n-i)//2]==s[(n-i)//2:-i]]))

Submission status: Runtime Error

Solution code:
s = deque(input())

while True:
    s.pop()
    if s[:len(s)//2] == s[len(s)//2:]:
        print(len(s))
        break

Submission status: Runtime Error

Solution code:
s = input()
for i in range(1, len(s)):
    a = collections.Counter(s[0:-i])
    even = True
    for j in a.values():
        if j%2!=0:
            even=False
    
    if even:
        print(len(s[0:-i]))
        exit()


    #print(a)

Submission status: Runtime Error

Solution code:
S=input()
for i in range(N-1):
  S=S[:-1]
  N=len(S)//2
  if S==S[:N]*2:
    print(N*2)
    exit()
print(1)

Submission status: Runtime Error

Solution code:
s=input()
n=len(s)
for i in range(n/2):
  s=s[:-2]
  if s[:len(s)]==s[len(s):]:
    print(len(s))

Submission status: Runtime Error

Solution code:
#create date: 2020-03-18 07:48

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    s = ns()
    s0 = s[0]
    n = len(s)
    m = (n-1)//2 + 1
    for i in range(1, m, 2):
        if s[i] == s0:
            if s[:i] ==s[i:2*i]:
                ans = i*2
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
s=input()
n=len(s)
for i in range(1,n+1):
  if s[0:i]==s[i:i+i]:
    print(i)
    break:

Submission status: Runtime Error

Solution code:
#create date: 2020-03-18 07:48

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    s = ns()
    s0 = s[0]
    for i in range(1, len(s)//2, 2):
        if s[i] == s0:
            if s[:i] ==s[i:2*i]:
                #print(s[:i], s[i:2*i])
                ans = i*2
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import numpy as np

S = str(input())

import numpy as np

for i in range(1,int(np.floor(len(S)/2))):
    j = int(np.floor(len(S)/2)) - i
    print(j)
    if first_str == second_str:
        num = 2*j
        break
    elif (first_str != second_str) & (j==1):
        num = 0
        break

print(num)

Submission status: Runtime Error

Solution code:
s=list(input())
while len(s) != 0:
  s.pop()
  if len(s)%2==0 and s[:len(s)//2]==s[len(s)//2:]:
    print(len(s)
    exit()

Submission status: Runtime Error

Solution code:
s = input()
for i in range(26):
    if chr(97+i) not in s: 
        print(chr(97+i)) 
        break
    if i == 25:
        print("None")
l.sort(reverse=True)
print(sum(l[:k]))
s = input()
for i in range(1,len(s)-1):
	if (len(s) - i) % 2 == 1: pass
	elif s[:(len(s) - i)//2] == s[(len(s) - i)//2:-i]:
		print(len(s) - i)
		#print(s[:-i])
		break

Submission status: Runtime Error

Solution code:
S = str(input())
count=0
for i in range(len(S)):
    S=S[:-1]
    if S//2==0:
        x=S//2
        count+=1
        if S[:x] == S[x+1:]:
            print(count)
            break

Submission status: Runtime Error

Solution code:
S = input()
while len(S):
    S.pop()
    if S[:len(S)//2+1] == S[len(S)//2+1:]:
        print(len(S[:len(S)//2+1]))
        exit()

Submission status: Runtime Error

Solution code:
s = input()
for k in range(len(s)//2-1, 0, -1)
  if s[:k] == s[k:2*k]: break
print(k)

Submission status: Runtime Error

Solution code:
# B - ss
S = str(input())
count = 0
ans_s = S[:-1]

while count <= len(ans_s):
    len_a = int(len(ans_s)/2)
    if len(ans_s) % 2 != 0:
        ans_s = ans_s[:-1]
        count += 1
    else ans_s[:len_a] == ans_s[len_a:]:
        print(len(ans_s))
        exit()

Submission status: Runtime Error

Solution code:
s = input()
while len(s)!=0:
    s.pop()
    if len(s)%2==0 and s[:len(s)//2]==s[len(s)//2:]:
        print(len(s))
        exit()

Submission status: Runtime Error

Solution code:
s = input()
while True:
    s.pop()
    if len(s)%2==0 and s[:len(s)//2]==s[len(s)//2:]:
        print(len(s))
        exit()

Submission status: Runtime Error

Solution code:
s=input()
l=len(s)
for _ in range(l)
  s.pop(l-1)
  if(s[:l//2]*2==s)
  print(l)

Submission status: Runtime Error

Solution code:
s = input()

abaababaabfor i in reversed(range(1, len(s)//2)):
    if s[:i] == s[i:2*i]:
        ans = i * 2
        break

print(ans)

Submission status: Runtime Error

Solution code:
s = input()
n = len(s)
ret = None
for i in range(n - 1, 0, -1):
    if len(s[:i]) % 2 == 1:
        continue
    # print(s[:i // 2], s[i // 2:i][::-1])
    if s[:i // 2] == s[i // 2:i][::-1]:
        ret = s[:i]
        break
print(len(ret))

Submission status: Runtime Error

Solution code:
s=input()
for i in reversed(range(0,len(s)-1,2)):
  if s[:len(s)//2]==s[len(s)//2:]:
    print(len(s))
    break
  else:
    s=[:len(s)-2]

Submission status: Runtime Error

Solution code:
s = list(input())
while len(s)>0:
  
  if len(s) % 2 == 0:
    s.pop().pop()
  else:
    s.pop()
    
  n = len(s)//2
  
  if s[:n] == s[n:]:
    print(len(s))
    break

Submission status: Runtime Error

Solution code:
s = list(input())
while len(s)>0:
  if len(s) % 2 == 0:
    s.pop(-1).pop(-1)
  else:
    s.pop(-1)
  n = len(s)//2
  if s[:n] == s[n-1:]:
    print(len(s))
    break

Submission status: Runtime Error

Solution code:
S = input()

hantei = True
ans = 0

while hantei == True:
    for i in range(len(S)//2):
        if S[i] != S[-i] or  S[i+1] != S[-(i+1)]:
            print("yes")
            S.strip(S[-1],S[-2])
            ans += 2
            break
        if i == len(S)//2:
            hantei = False
            break
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
s=input()
ans=len(s)
def check(m):
  a=len(m)
  if a%2==1:
    return False
  else:
    if s[0:m//2]==s[m//2:m]:
      return True
    else:
      return False
for i in range(1,len(s),-1):
  ans-=1
  if check(s[0:i])==True:
    print(ans)

Submission status: Runtime Error

Solution code:
S = input()
for i in range(S//2, 0, -1):
  if S.find(S[:i], i) == i:
    break
print(i)

Submission status: Runtime Error

Solution code:
s=int(input())

for n in range(1,len(s)-1):
    s=s[:-2]
    if s[:len(s)//2]==s[len(s)//2:]:
        break
print(len(s))

Submission status: Runtime Error

Solution code:
s=list(input())
x=len(s)

for i range(1,x//2):
    s=s[:-2]
    if s[:len(s)//2==s[len(s)//2:]:
            break
print(len(s))

Submission status: Runtime Error

Solution code:
s=list(input())
x=len(s)

for i i range(1,x//2):
    s=s[:-2]
    if s[:len(s)//2==s[len(s)//2:]:
            break
print(len(s))

Submission status: Runtime Error

Solution code:
S = list(str(input()))

ans = 0
num = 0
while num < len(S):
  num += 1
  s = S[:len(S)-num]
  if len(s) % 2 == 0:
  　　if s[:len(s)/2] == s[len(s)/2:]:
        ans = len(s)
        break
print(ans)

Submission status: Runtime Error

Solution code:
S = input()

def check(s):
    n = len(s)
    if n%2 != 0:
        return False
    else:
        s1 = s[:(n//2)]
        s2 = s[(n//2):]
        if s1 == s2:
            return True
        else:
            return False

for i in range(len(S)-1, 0, -2):
    if check(S[:i]):
        ans = len(S[:i])
        break

print(ans)

Submission status: Runtime Error

Solution code:
s = input()
a=0
b=0
def sakana():
  for j in range(len(s)//2):
    if s[j] != s[(len(s)//2)+j]:
      break
    else:
      a=a+1
  if a==len(s)//2:
    return 0
  else:
    return 1

for i in range(len(s)):
  s.rstrip(s[-1])
  if len(s)%2==0 and sakana()==0:
    break
  else:
    b=b+1
print(len(s)-b-1)

Submission status: Runtime Error

Solution code:
w=list(input())
for i in range(len(w)):
  del w[-1]
  del w[-1]
  if w[0:len(w)/2]==w[len(w)/2:len(w)]:
    print(len(w))
    break

Submission status: Runtime Error

Solution code:
S = input()
result = ''
for i in range(1, len(S)):
    s = S[0:len(S) - i]
	if len(s) % 2 == 0 and s[0:len(s)//2] == s[len(s)//2:]:
        result = len(s)
        break

print(result)

Submission status: Runtime Error

Solution code:
t = list(input())
del s [-2:]
a = 2
while s[:len(s)//2] != s[len(s)//2:]:
    s = s[:-2]
    a += 2
print(a)

Submission status: Runtime Error

Solution code:
s=list(input())
while(1):
    if len(s)==1:
        print(s)
        break
    s.pop(-1)
    if s[:t]==s[t:]:
        print(len(s))
        break
    t=int(len(s)/2)

Submission status: Runtime Error

Solution code:
s = input()
for i in range(len(s),1,-2):
  if s[:i/2+1] == s[i/2+1:]:
    print(len(s[:i/2+1]))
    break

Submission status: Runtime Error

Solution code:
S = gets.chomp.split("")
L = S.length
while L > 0
    L -= 1
    A = S[0...L/2]
    B = S[L/2...L]
    if A == B
        puts L
       break
    end
end

Submission status: Runtime Error

Solution code:
s=input()
while(1):
  s=s[:-2]
  l=len(s)
  if s[:l/2]==s[l/2:]:
    print(l)
    break

Submission status: Runtime Error

Solution code:
s=input()
while(1):
  s=s[:-2]
  l=len(s)
  if s[:l/2]==s[l/2:]:
  	print(l)
    break

Submission status: Runtime Error

Solution code:
s=input()
s=list(s)
if len(s)%2==0:
    s.pop(len(s)-1)
    s.pop(len(s)-1)
else:
    s.pop(len(s)-1)

while len(s)>0:
    if s[:int(len(s)/2)]==s[int(len(s)/2):]:
        print(len(s))
        sys.exit()
    s.pop(len(s)-1)
    s.pop(len(s)-1)

Submission status: Runtime Error

Solution code:
print((lambda s:[s for s in reversed(range(len(s))) if len(s)%2==0 and s[:len(s)//2]==s[len(s)//2:]][0])(input()))

Submission status: Runtime Error

Solution code:
S = input()
for i in range(len(S) -1,-1,-1):
  if i % 2 != 0:
    continue
  if s[:i // 2] == s[i // 2:i]:
    print(i)
    break

Submission status: Runtime Error

Solution code:
s = input()
for i in range(len(s)):
    s = s[:-1]
    if len(s)%2 == 0:
        if s[:len(s)/2] == s[len(s)/2:]:
            print(len(s))
            break

Submission status: Runtime Error

Solution code:

Beta
  paiza.IO
新規コード
一覧
ウェブ開発  
New!
日本語  サインアップ ログイン
Python3 Split Button!	
Enter a title here
Main.py 
Success  

  
1
2
3
4
5
6
7
8
9
10
11
12
13
def chunked(iterable, n):
    return [iterable[x:x + n] for x in range(0, len(iterable), n)]
s=input()
for i in range(1,len(s)):
    a=s[:(-1*i)]
    if len(a)>1:
        li=chunked(a,(len(a)+1)//2)
        
        if li[0]==li[1]:
            print(len(a))
            quit()
    
  実行 (Ctrl-Enter) Split Button!             
出力
入力
コメント 0
(0.04 sec)
 
2

Submission status: Runtime Error

Solution code:
s = str(input())
n = len(s)
s = s.rstrip(s[n-1])
for i in range(n):
	a = len(s)
	if (a % 2) == 0:
		ss = s[0:a//2]
		if s.count(ss) == 2:
			print(a)
			break
		else:
			s = s.rstrip(s[a-1])
	else:
		s = s.rstrip(s[a-1])

Submission status: Runtime Error

Solution code:
s = str(input())
n = len(s)
s = s.rstrip(s[n-1])
for i in range(n):
	a = len(s)
	if (a % 2) == 0:
		ss = s[0:a//2]
		print(s.count(ss))
		if s.count(ss) == 2:
			print(a)
			break
		else:
			s = s.rstrip(s[a-1])
	else:
		s = s.rstrip(s[a-1])

Submission status: Runtime Error

Solution code:
#!/usr/bin
# -*- coding:"utf-8" -*-

s = input()
sn = len(s)

if sn % 2 == 1:
  sn = sn -1
for i in range(sn, 0, -2)
  if s[:i/2] == s[i/2:]:
    break
print(s[:i])

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
    s = input()
    data = list(s)
    while len(data):
         data.pop()
         if len(data) % 2 == 0:
             if data[:len(data) / 2] == data[len(data) / 2 + 1:]:
                 print(len(data) / 2)
                 break

Submission status: Runtime Error

Solution code:
s = input()

s = s[:-1]
if len(s) % 2 != 0:
    s = s[:-1]


while(True):
    s1, s2 = zip(*[iter(s)]*2)
    if s1 is s2:
        print(s1)
        break

    s = s[:-2]

Submission status: Runtime Error

Solution code:
s = input()

s = a[:-1]
if len(s) % 2 != 0:
    s = s[:-1]


while(True):
    s1, s2 = zip(*[iter(s)]*2)
    if s1 is s2:
        print(s1)
        break

    s = s[:-2]

Submission status: Runtime Error

Solution code:
s = input()

for i in reversed(range(1, int((len(s)-1)/2+1))):
    if(s[:i] == s[i:2*i]):
        print(2*i)
        return

Submission status: Runtime Error

Solution code:
string = []
l = raw_input().split()
length = len(l)
for i in range(length):
	string.append(l[i])
for j in range(length):
	string.pop(-1)
	string.pop(-1)
	num = len(string)/2
	if string[0:num] == string[num+1:len(string)]:
		print len(string) + 1
		break
	else:
		pass

Submission status: Runtime Error

Solution code:
s = input()

def iseven(str, n):
    for i in range(0, n/2):
        if str[i] != str[i+n/2]:
            return False
    else:
        return True


for i in range(2, n, 2):
    if iseven(s, n-i):
        print(i)

Submission status: Runtime Error

Solution code:
def f(x):
    return len(x) % 2 == 0 and x[:len(x)/2] == x[len(x)/2:]

x=input()
while not f(x):
    x=x[:-1]

print(len(x))

Submission status: Runtime Error

Solution code:
def f(x):
    return len(x) % 2 == 0 and x[:len(x)/2] == x[len(x)/2:]
x=input()
while f(x):
    x=x[:-1]
print(len(x))

Submission status: Runtime Error

Solution code:
from sys import stdin
s = stdin.readline().strip()
n = len(s)
n-=2
while True:
 if s[n/2]== s[n/2+1:n]:
  break
 n-=2
print n

Submission status: Runtime Error

Solution code:
S = list(input())
length = len(S)
if length == 2:
    ans = 0
if length % 2 == 1:
    length -= 1
    ans = 0
else:
    length -= 2

def hantei(list_str,n):
    k = int(n/2)
    if list_str[0:k] == list_str[k:n]:
        return n
    else:
        return 0

while length != 2:
        ans = hantei(S,length)
        if ans != 0:
            break
        length -= 2

if ans == 0 :
    print(1)
else:
    print(ans)

Submission status: Runtime Error

Solution code:
S = list(input())
length = len(S)
if length % 2 == 1:
    length -= 1
else:
    length -= 2

def hantei(list_str,n):
    k = int(n/2)
    if list_str[0:k] == list_str[k:n]:
        return n
    else:
        return 0

while length != 2:
        ans = hantei(S,length)
        if ans != 0:
            break
        length -= 2

if ans == 0 :
    print(1)
else:
    print(ans)

Submission status: Runtime Error

Solution code:
    S = input()
    for i in range(len(S) - 1, 0, -1):
        if(S[0:i//2] == S[i//2:i]):
            print(i)
            break