#Y1013. 简单字符串
简单字符串
Background:
Bored and learned the string
Problem Description:
Definition: if the end of the string s and the beginning of the two characters match, we call s and t can "connected" (note: this t after s) when several string "connected" into a ring, we call a "character ring" (if a string can end to end, also called "character ring")
Now, given the 's string of lowercase letters, and connect them one after the other, finds the "character ring" of the longest average length. gave an example:
insleknflsdkal
alskdfiends
dsdinfeslkfjin
As above, the first string can be "connected" to the second string, the second can be "connected" to the third, and the third can also be "connected" to the first, thus forming a "character ring". Such a "character ring", with a length of 14 + 11 + 14=39 (the end of the connection), uses a total of three strings, so the average length is 39 / 3=13.
Since has very few programming skills, wants to seek your help.
Input Format:
The first row has a positive integer, n, representing the number of input strings
Next n lines, one string Si for each line
Output Format:
One row, which output the longest "character ring" average length.(Accurate to 10 decimal places) Note: If there is no character ring, output " None.”。
Input / Output sample:
Enter # 1
3
insleknflsdkal
alskdfiends
dsdinfeslkfjin
Output #1
13.0000000000
统计
相关
在下列比赛中: