topic:
If a string is connected by two identical strings, the string is called a couple strings. For example, "xyzxyz" and "aaaaaa" are even strings, but "Ababab" and "Xyzxy" are not.
cows now give you a string s that contains only lowercase letters, you can delete 1 and or more characters from the end of the string s to ensure that after the deletion of the string or a couple of strings, Niu Niu want to know how long after the deletion of the length of the string.
Enter a description:
The input includes a string s, length of string (2≤length≤200), which guarantees that s is a string and is composed of lowercase letters.
Output Description:
Outputs an integer that indicates how long the longest string of strings can be obtained after the deletion. Ensure that the test data has a non 0 solution
Enter Example 1:
Abaababaab
Output Example 1:6
Import Java.util.Scanner;
public class Oustring {public
static void Main (string[] args) {
Scanner sc = new Scanner (system.in);
String Str=sc.next ();
SYSTEM.OUT.PRINTLN (Getlenth (str));
private static int getlenth (String str) {
int len=str.length ();
int i=1;
int end=len-1;//string Deletes the last one first;
if (len<2 | | | len>200) return
0;
while (end>1) {
String sub=str.substring (0, end);
String str1=str.substring (0,END/2);
String str2=str.substring (END/2, end);
if (Str1.equals (str2)) {return end
;
} else{
end=len-i;
i++
}
}
return 0;
}
}