#P2138. 小Z的关系距离
小Z的关系距离
Description
Xiao Z has studied dialectical materialism and learned that connections are universal. Looking at the strings on his scratch paper, he wants to explore the relationships between them.
Xiao Z believes that for two strings , if each can delete no more than half of its own length of characters to become equal, then are said to have a relationship with distance . If there exists another string that has a distance of with and a distance of with , then are said to have a relationship with distance .
Now Xiao Z randomly selects two lowercase letter strings and wants to know the minimal relationship distance between them. Please help him.
Input Format
The first line contains a string .
The second line contains a string .
Output Format
The first line contains an integer indicating the minimal relationship distance between .
abcdef
axcyd
1
a
b
2
abb
baa
2
Hint
For of the testdata, are composed of the same letter.
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号