|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||128 MB||112||18||14||37.838%|
After the recent apocalypse, Azamat, finally, learned about the largest common subsequences of two strings and now he is interested, what will be the largest common subsequence of two round words?
In a round word there is no difference from which symbol the word starts and in which direction it is read.
For instance, the round word "algorithm" can be read as "rithmalgo" and as "oglamhtir".
For usual words "algorithm" and "grammar" the longest common subsequence length is 3 (the word "grm"), and for round variant of the same word the length of the longest common subsequence is 4 (the word "grma").
Azamat quickly found out that the standard algorithm cannot get right answer for round words. Write the program which will do that for him.
Two lines contain one word each. Words are non-empty and the length of each words doesn't exceed 2000 characters.
The single line must contain one integer number - the length of the longest common subsequence of the given round words.