import java.util.*; public class Main{ public static void main(String[]args){ Scanner sc=new Scanner(System.in); String input=sc.nextLine(); String new_input=" "+input; char[]str=new_input.toCharArray(); int start=0; int n=input.length(); int[] next=new int[n+1]; // 构建next数组 for(int i=2,j=0;i<=n;i++){ while(j>0&&str[i]!=str[j+1]){ j=next[j]; } if(str[i]==str[j+1]){ j++; } next[i]=j; } StringBuilder sb=new StringBuilder(input); sb.append(input.substring(next[n])); System.out.println(sb.toString()); } }